Added Files
This commit is contained in:
BIN
Powershell/Data/Abbr/.computer.csv.swp
Normal file
BIN
Powershell/Data/Abbr/.computer.csv.swp
Normal file
Binary file not shown.
50
Powershell/Data/Abbr/aviation.csv
Normal file
50
Powershell/Data/Abbr/aviation.csv
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
Abbreviation,Definition
|
||||||
|
AB,Air Base
|
||||||
|
AC,Aircraft
|
||||||
|
ACAS,Airborne Collision Avoidance System
|
||||||
|
ACC,Area Control Centre
|
||||||
|
AF,Air Field
|
||||||
|
AFM,Aircraft Flight Manual
|
||||||
|
AIP,Aeronautical Information Publication
|
||||||
|
AMAN,Arrival Manager
|
||||||
|
AOA,Angle of Attack
|
||||||
|
AOM,Airplane Operating Manual
|
||||||
|
AOR,Area of Responsibility
|
||||||
|
AFIS,Aerodrome Flight Information Service
|
||||||
|
AFM,Airplane Flight Manual
|
||||||
|
AGL,Above Ground Level
|
||||||
|
AIP,Aeronautical Information Publication
|
||||||
|
ANSP,Air Navigation Service Provider
|
||||||
|
ARTCC,Air Route Traffic Control Centre
|
||||||
|
ASB,Airspace Block
|
||||||
|
ATA,Actual Time of Arrival
|
||||||
|
ATC,Air Traffic Control
|
||||||
|
ATIS,Automatic Terminal Information Service
|
||||||
|
ATO,Air Traffic Organization
|
||||||
|
BAF,Belgian Air Force
|
||||||
|
CAAC,Civil Aviation Administration of China
|
||||||
|
CAAS,Civil Aviation Authorization of Singapore
|
||||||
|
CANSO,Civil Air Navigation Services Organization
|
||||||
|
CAS,Calibrated Airspeed
|
||||||
|
CAT,Category of Aircraft
|
||||||
|
CAVOK,Ceiling And Visibility OK
|
||||||
|
COG,Center of Gravity
|
||||||
|
CRDA,Converging Runway Display Aid
|
||||||
|
CTA,Controlled Time of Arrival
|
||||||
|
CTA,Controlled Area
|
||||||
|
CTOT,Calculated Take-Off Time
|
||||||
|
CTR,Control Zone or Controlled Traffic Region
|
||||||
|
ECAC,European Civil Aviation Conference
|
||||||
|
FIA,Flight Information Area
|
||||||
|
FIR,Flight Information Region
|
||||||
|
FL,Flight Level
|
||||||
|
IAS,Indicated Air Speed
|
||||||
|
LL,Lower Limit
|
||||||
|
LTA,Lower Traffic Area
|
||||||
|
MEA,Minimum En-route Altitude
|
||||||
|
OCTA,Outside Control Areas
|
||||||
|
TA,Terminal Airspace
|
||||||
|
TAS,Terminal Airspace System
|
||||||
|
TMA,Terminal Control Area
|
||||||
|
UTA,Upper Traffic Area
|
||||||
|
VTC,Visual Terminal Chart
|
||||||
|
46
Powershell/Data/Abbr/computer.csv
Normal file
46
Powershell/Data/Abbr/computer.csv
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
Abbreviation,Definition
|
||||||
|
ACID,"Atomicity, Consistency, Isolation, Durability"
|
||||||
|
ACL,Access Control List
|
||||||
|
ADC,Analog-to-Digital Converter
|
||||||
|
ADF,Automatic Document Feeder
|
||||||
|
ADSL,Asymmetric Digital Subscriber Line
|
||||||
|
AFP,Apple Filing Protocol
|
||||||
|
AGP,Accelerated Graphics Port
|
||||||
|
AIFF,Audio Interchange File Format
|
||||||
|
ALU,Arithmetic Logic Unit
|
||||||
|
ANSI,American National Standards Institute
|
||||||
|
API,Application Programming Interface
|
||||||
|
APU,Accelerated Processing Unit
|
||||||
|
ARP,Address Resolution Protocol
|
||||||
|
ASCII,American Standard Code for Information Interchange
|
||||||
|
ASP,Application Service Provider
|
||||||
|
ATM,Asynchronous Transfer Mode
|
||||||
|
AVR,Audio/Video Receiver
|
||||||
|
Bash,Bourne-Again Shell
|
||||||
|
BASIC,Beginner's All-purpose Symbolic Instruction Code
|
||||||
|
BCC,Blind Carbon Copy
|
||||||
|
BIOS,Basic Input/Output System
|
||||||
|
BLE,Bluetooth Low Energy
|
||||||
|
Blob,Binary Large Object
|
||||||
|
BMP,Bitmap
|
||||||
|
BSOD,Blue Screen of Death
|
||||||
|
CAD,Computer-Aided Design
|
||||||
|
CAN,Campus Area Network
|
||||||
|
CD,Compact Disc
|
||||||
|
CPU,Central Processing Unit
|
||||||
|
CSV,Comma Separated Values (file format)
|
||||||
|
DDL,Data Definition Language
|
||||||
|
IDE,Integrated Development Environment
|
||||||
|
GPU,Graphics Processing Unit
|
||||||
|
GUI,Graphical User Interface
|
||||||
|
IP,Internet Protocol
|
||||||
|
ISP,Internet Service Provider
|
||||||
|
IT,Information Technology
|
||||||
|
LAN,Local Area Network
|
||||||
|
LCD,Liquid Crystal Display
|
||||||
|
NIC,Network Interface Card
|
||||||
|
PC,Personal Computer
|
||||||
|
RAM,Random Access Memory
|
||||||
|
URL,Uniform Resource Locator
|
||||||
|
VPN,Virtual Private Network
|
||||||
|
WAN,Wide Area Network
|
||||||
|
42
Powershell/Data/Abbr/cooking.csv
Normal file
42
Powershell/Data/Abbr/cooking.csv
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
Abbreviation,Definition
|
||||||
|
btl,Bottle
|
||||||
|
c,Cup
|
||||||
|
C,Cups
|
||||||
|
DF,Dairy free
|
||||||
|
doz,dozen
|
||||||
|
dp,drop
|
||||||
|
fl oz,Fluid ounce
|
||||||
|
fl ozs,Fluid ounces
|
||||||
|
g,Grams
|
||||||
|
gal,Gallons
|
||||||
|
gals,Gallons
|
||||||
|
GF,Gluten free
|
||||||
|
kg,Kilograms
|
||||||
|
L,Litres
|
||||||
|
l,Litres
|
||||||
|
lb,Pound
|
||||||
|
lbs,Pounds
|
||||||
|
lg,large
|
||||||
|
lge,large
|
||||||
|
md,medium
|
||||||
|
med,medium
|
||||||
|
mg,Milligrams
|
||||||
|
ml,Millilitres
|
||||||
|
NRV,Nutrient Reference Value
|
||||||
|
oz,Ounce
|
||||||
|
ozs,Ounces
|
||||||
|
pers,person(s)
|
||||||
|
pn,Pinch
|
||||||
|
pt,Pint
|
||||||
|
pts,Pints
|
||||||
|
qt,Quart
|
||||||
|
qts,Quarts
|
||||||
|
RI,Reference Intake
|
||||||
|
serv,serving
|
||||||
|
sm,small
|
||||||
|
srv,serving
|
||||||
|
Tbsp,Tablespoon
|
||||||
|
tsp,Teaspoon
|
||||||
|
VG,vegetarian
|
||||||
|
VN,Vegan
|
||||||
|
WF,Wheat free
|
||||||
|
14
Powershell/Data/Abbr/medicine.csv
Normal file
14
Powershell/Data/Abbr/medicine.csv
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
Abbreviation,Definition
|
||||||
|
PR,per the rectum
|
||||||
|
pr,per the rectum
|
||||||
|
PT,prothrombin time
|
||||||
|
PTT,partial thromboplastin time
|
||||||
|
pulv,powder
|
||||||
|
PV,per the vagina
|
||||||
|
q,every
|
||||||
|
q12h,every 12 hours
|
||||||
|
qd,daily
|
||||||
|
q1d,daily
|
||||||
|
q2h,every 2 hours
|
||||||
|
q3h,every 3 hours
|
||||||
|
q4h,every 4 hours
|
||||||
|
81
Powershell/Data/Abbr/music.csv
Normal file
81
Powershell/Data/Abbr/music.csv
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
Abbreviation,Definition
|
||||||
|
8va,Octave up
|
||||||
|
ad lib,Ad Libitum (“freely”)
|
||||||
|
afl,Alto flute
|
||||||
|
AS,Al Segno (“To the sign”)
|
||||||
|
bc,Basso Continuo (“continuous bass accompaniment”)
|
||||||
|
bcl,Bass clarinet
|
||||||
|
bfl,Bass flute
|
||||||
|
bpm,Beats per minute
|
||||||
|
bn,Bassoon
|
||||||
|
bob,Bass oboe
|
||||||
|
br,Brass instruments
|
||||||
|
bstcl,Basset clarinet
|
||||||
|
bsthn,Basset horn
|
||||||
|
bug,Bugle
|
||||||
|
cbcl,Contrabass clarinet
|
||||||
|
cbn,Contrabassoon
|
||||||
|
cf,Cantus Firmus (“main melody”)
|
||||||
|
cl,Clarinet
|
||||||
|
cresc,Crescendo (also noted as <)
|
||||||
|
crt,Cornet
|
||||||
|
D.C. al Coda,Da Capo al Coda (“from the beginning to the Coda sign”)
|
||||||
|
D.C. al Fine,Da Capo al Fine (“from the beginning to the end”)
|
||||||
|
D.S. al Fine,Dal Segno al Fine (“from the Segno mark to the end”)
|
||||||
|
decresc,Descrescendo (also noted as >)
|
||||||
|
dim,Diminuendo
|
||||||
|
eh,English horn
|
||||||
|
euph,Euphonium
|
||||||
|
f,Forte
|
||||||
|
fda,Flute d’amore (tenor flute)
|
||||||
|
ff,Fortissimo
|
||||||
|
fff,Fortississimo
|
||||||
|
fgh,Flugelhorn
|
||||||
|
fl,Flute
|
||||||
|
fp,Fortepiano
|
||||||
|
gliss,Glissando (“gliding, sliding”)
|
||||||
|
hn,Horn
|
||||||
|
m,Measure
|
||||||
|
mm,Measures
|
||||||
|
MM,Metronome tempo
|
||||||
|
mf,Mezzo-Forte
|
||||||
|
mp,Mezzo-Piano
|
||||||
|
mvt,Movement
|
||||||
|
ob,Oboe
|
||||||
|
oda,Oboe d’amore
|
||||||
|
orch,Orchestra
|
||||||
|
p,Piano
|
||||||
|
p,Page,
|
||||||
|
pan,Pan flute
|
||||||
|
pic,Piccolo
|
||||||
|
picc,Piccolo
|
||||||
|
pizz,Pizzicato (“plucking”)
|
||||||
|
pp,Pianissio
|
||||||
|
pp,Pages
|
||||||
|
ppp,Pianississimo
|
||||||
|
rall,Rallentando (“gradual slowing”)
|
||||||
|
rec,Recorder
|
||||||
|
rit,Ritardando (“slowing down”)
|
||||||
|
Rf,Rinforzando (“with sudden force”)
|
||||||
|
Rfz,Rinforzando (“with sudden force”)
|
||||||
|
rpm,Revolutions per minute
|
||||||
|
sax,Saxophone
|
||||||
|
sf,Sforzando, Sforzato (“sudden accent”)
|
||||||
|
sfz,Sforzando, Sforzato (“sudden accent”)
|
||||||
|
sfp,Sforzando followed by Piano
|
||||||
|
smorz,Smorzando (“dying away”)
|
||||||
|
sord,Sordino (“muted”)
|
||||||
|
sost. ped,Sostenuto pedal (“sustained pedal”)
|
||||||
|
spicc,Spiccato (“bounce bow on a stringed instrument”)
|
||||||
|
stacc,Staccato (“playing each note separately from the others”)
|
||||||
|
stpt,Slide trumpet
|
||||||
|
sul pont,Sul Ponticello (“playing with the bow near the bridge”)
|
||||||
|
tba,Tuba
|
||||||
|
tbn,Trombone
|
||||||
|
tpt,Trumpet
|
||||||
|
tr,Trill
|
||||||
|
trem,Tremolo (“trembling, wavering”)
|
||||||
|
tsx,Tenor saxophone
|
||||||
|
vib,Vibrato (“pulsing, vibrating”)
|
||||||
|
vol,Volume
|
||||||
|
ww,Woodwinds
|
||||||
|
5843
Powershell/Data/Abbr/various.csv
Normal file
5843
Powershell/Data/Abbr/various.csv
Normal file
File diff suppressed because it is too large
Load Diff
6
Powershell/Data/Checklists/handwashing.txt
Normal file
6
Powershell/Data/Checklists/handwashing.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
HEAD Handwashing
|
||||||
|
Wet your hands with clean, running water (warm or cold), turn off the tap, and apply soap.
|
||||||
|
Lather your hands by rubbing them together with the soap. Lather the backs of your hands, between your fingers, and under your nails.
|
||||||
|
Scrub your hands for at least 20 seconds.
|
||||||
|
Rinse your hands well under clean, running water.
|
||||||
|
Dry your hands using a clean towel or air dry them.
|
||||||
45
Powershell/Data/Help/WindowsTerminal.txt
Normal file
45
Powershell/Data/Help/WindowsTerminal.txt
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
Windows Terminal Cheat Sheet
|
||||||
|
============================
|
||||||
|
|
||||||
|
Application
|
||||||
|
-----------
|
||||||
|
Alt-F4 Close window
|
||||||
|
Ctrl-Shift-f Find
|
||||||
|
Ctrl-Shift-Space Open dropdown
|
||||||
|
Ctrl-, Open settings file
|
||||||
|
Alt-Enter Toggle full screen
|
||||||
|
F11
|
||||||
|
|
||||||
|
Tab Commands
|
||||||
|
------------
|
||||||
|
Ctrl-Shift-d Duplicate tab
|
||||||
|
Ctrl-Shift-t New tab
|
||||||
|
Ctrl-Shift-p New tab from profile p=1..9
|
||||||
|
Ctrl-Tab Switch to next tab
|
||||||
|
Ctrl-Shift-Tab Switch to previous tab
|
||||||
|
Ctrl-Alt-n Switch to tab n=0..9
|
||||||
|
|
||||||
|
Pane Commands
|
||||||
|
-------------
|
||||||
|
Alt-Shift-d Split pane optimally. Active profile.
|
||||||
|
Alt-Shift-- Split pane horizontally. Default profile.
|
||||||
|
Alt-Shift-+ Split pane vertically. Default profile.
|
||||||
|
Ctrl-Shift-w Close innermost pane, tab, or window
|
||||||
|
|
||||||
|
Clipboard Commands
|
||||||
|
------------------
|
||||||
|
Ctrl-c Copy
|
||||||
|
Ctrl-v Paste
|
||||||
|
|
||||||
|
Scrollback Commands
|
||||||
|
-------------------
|
||||||
|
Ctrl-Shift-up Scroll up
|
||||||
|
Ctrl-Shift-down Scroll down
|
||||||
|
Ctrl-Shift-pgup Scroll page up
|
||||||
|
Ctrl-Shift-pgdn Scroll page down
|
||||||
|
|
||||||
|
Visual Adjustment Commands
|
||||||
|
--------------------------
|
||||||
|
Ctrl-= Increase font size
|
||||||
|
Ctrl-- Decrease font size
|
||||||
|
Ctrl-0 Reset font size
|
||||||
29191
Powershell/Data/IEEE-MAC-vendors.csv
Normal file
29191
Powershell/Data/IEEE-MAC-vendors.csv
Normal file
File diff suppressed because it is too large
Load Diff
185
Powershell/Data/ISO639-1-language-codes.csv
Normal file
185
Powershell/Data/ISO639-1-language-codes.csv
Normal file
@@ -0,0 +1,185 @@
|
|||||||
|
alpha2,English
|
||||||
|
aa,Afar
|
||||||
|
ab,Abkhazian
|
||||||
|
ae,Avestan
|
||||||
|
af,Afrikaans
|
||||||
|
ak,Akan
|
||||||
|
am,Amharic
|
||||||
|
an,Aragonese
|
||||||
|
ar,Arabic
|
||||||
|
as,Assamese
|
||||||
|
av,Avaric
|
||||||
|
ay,Aymara
|
||||||
|
az,Azerbaijani
|
||||||
|
ba,Bashkir
|
||||||
|
be,Belarusian
|
||||||
|
bg,Bulgarian
|
||||||
|
bh,Bihari languages
|
||||||
|
bi,Bislama
|
||||||
|
bm,Bambara
|
||||||
|
bn,Bengali
|
||||||
|
bo,Tibetan
|
||||||
|
br,Breton
|
||||||
|
bs,Bosnian
|
||||||
|
ca,Catalan; Valencian
|
||||||
|
ce,Chechen
|
||||||
|
ch,Chamorro
|
||||||
|
co,Corsican
|
||||||
|
cr,Cree
|
||||||
|
cs,Czech
|
||||||
|
cu,Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic
|
||||||
|
cv,Chuvash
|
||||||
|
cy,Welsh
|
||||||
|
da,Danish
|
||||||
|
de,German
|
||||||
|
dv,Divehi; Dhivehi; Maldivian
|
||||||
|
dz,Dzongkha
|
||||||
|
ee,Ewe
|
||||||
|
el,"Greek, Modern (1453-)"
|
||||||
|
en,English
|
||||||
|
eo,Esperanto
|
||||||
|
es,Spanish; Castilian
|
||||||
|
et,Estonian
|
||||||
|
eu,Basque
|
||||||
|
fa,Persian
|
||||||
|
ff,Fulah
|
||||||
|
fi,Finnish
|
||||||
|
fj,Fijian
|
||||||
|
fo,Faroese
|
||||||
|
fr,French
|
||||||
|
fy,Western Frisian
|
||||||
|
ga,Irish
|
||||||
|
gd,Gaelic; Scottish Gaelic
|
||||||
|
gl,Galician
|
||||||
|
gn,Guarani
|
||||||
|
gu,Gujarati
|
||||||
|
gv,Manx
|
||||||
|
ha,Hausa
|
||||||
|
he,Hebrew
|
||||||
|
hi,Hindi
|
||||||
|
ho,Hiri Motu
|
||||||
|
hr,Croatian
|
||||||
|
ht,Haitian; Haitian Creole
|
||||||
|
hu,Hungarian
|
||||||
|
hy,Armenian
|
||||||
|
hz,Herero
|
||||||
|
ia,Interlingua (International Auxiliary Language Association)
|
||||||
|
id,Indonesian
|
||||||
|
ie,Interlingue; Occidental
|
||||||
|
ig,Igbo
|
||||||
|
ii,Sichuan Yi; Nuosu
|
||||||
|
ik,Inupiaq
|
||||||
|
io,Ido
|
||||||
|
is,Icelandic
|
||||||
|
it,Italian
|
||||||
|
iu,Inuktitut
|
||||||
|
ja,Japanese
|
||||||
|
jv,Javanese
|
||||||
|
ka,Georgian
|
||||||
|
kg,Kongo
|
||||||
|
ki,Kikuyu; Gikuyu
|
||||||
|
kj,Kuanyama; Kwanyama
|
||||||
|
kk,Kazakh
|
||||||
|
kl,Kalaallisut; Greenlandic
|
||||||
|
km,Central Khmer
|
||||||
|
kn,Kannada
|
||||||
|
ko,Korean
|
||||||
|
kr,Kanuri
|
||||||
|
ks,Kashmiri
|
||||||
|
ku,Kurdish
|
||||||
|
kv,Komi
|
||||||
|
kw,Cornish
|
||||||
|
ky,Kirghiz; Kyrgyz
|
||||||
|
la,Latin
|
||||||
|
lb,Luxembourgish; Letzeburgesch
|
||||||
|
lg,Ganda
|
||||||
|
li,Limburgan; Limburger; Limburgish
|
||||||
|
ln,Lingala
|
||||||
|
lo,Lao
|
||||||
|
lt,Lithuanian
|
||||||
|
lu,Luba-Katanga
|
||||||
|
lv,Latvian
|
||||||
|
mg,Malagasy
|
||||||
|
mh,Marshallese
|
||||||
|
mi,Maori
|
||||||
|
mk,Macedonian
|
||||||
|
ml,Malayalam
|
||||||
|
mn,Mongolian
|
||||||
|
mr,Marathi
|
||||||
|
ms,Malay
|
||||||
|
mt,Maltese
|
||||||
|
my,Burmese
|
||||||
|
na,Nauru
|
||||||
|
nb,"Bokmål, Norwegian; Norwegian Bokmål"
|
||||||
|
nd,"Ndebele, North; North Ndebele"
|
||||||
|
ne,Nepali
|
||||||
|
ng,Ndonga
|
||||||
|
nl,Dutch; Flemish
|
||||||
|
nn,"Norwegian Nynorsk; Nynorsk, Norwegian"
|
||||||
|
no,Norwegian
|
||||||
|
nr,"Ndebele, South; South Ndebele"
|
||||||
|
nv,Navajo; Navaho
|
||||||
|
ny,Chichewa; Chewa; Nyanja
|
||||||
|
oc,Occitan (post 1500)
|
||||||
|
oj,Ojibwa
|
||||||
|
om,Oromo
|
||||||
|
or,Oriya
|
||||||
|
os,Ossetian; Ossetic
|
||||||
|
pa,Panjabi; Punjabi
|
||||||
|
pi,Pali
|
||||||
|
pl,Polish
|
||||||
|
ps,Pushto; Pashto
|
||||||
|
pt,Portuguese
|
||||||
|
qu,Quechua
|
||||||
|
rm,Romansh
|
||||||
|
rn,Rundi
|
||||||
|
ro,Romanian; Moldavian; Moldovan
|
||||||
|
ru,Russian
|
||||||
|
rw,Kinyarwanda
|
||||||
|
sa,Sanskrit
|
||||||
|
sc,Sardinian
|
||||||
|
sd,Sindhi
|
||||||
|
se,Northern Sami
|
||||||
|
sg,Sango
|
||||||
|
si,Sinhala; Sinhalese
|
||||||
|
sk,Slovak
|
||||||
|
sl,Slovenian
|
||||||
|
sm,Samoan
|
||||||
|
sn,Shona
|
||||||
|
so,Somali
|
||||||
|
sq,Albanian
|
||||||
|
sr,Serbian
|
||||||
|
ss,Swati
|
||||||
|
st,"Sotho, Southern"
|
||||||
|
su,Sundanese
|
||||||
|
sv,Swedish
|
||||||
|
sw,Swahili
|
||||||
|
ta,Tamil
|
||||||
|
te,Telugu
|
||||||
|
tg,Tajik
|
||||||
|
th,Thai
|
||||||
|
ti,Tigrinya
|
||||||
|
tk,Turkmen
|
||||||
|
tl,Tagalog
|
||||||
|
tn,Tswana
|
||||||
|
to,Tonga (Tonga Islands)
|
||||||
|
tr,Turkish
|
||||||
|
ts,Tsonga
|
||||||
|
tt,Tatar
|
||||||
|
tw,Twi
|
||||||
|
ty,Tahitian
|
||||||
|
ug,Uighur; Uyghur
|
||||||
|
uk,Ukrainian
|
||||||
|
ur,Urdu
|
||||||
|
uz,Uzbek
|
||||||
|
ve,Venda
|
||||||
|
vi,Vietnamese
|
||||||
|
vo,Volapük
|
||||||
|
wa,Walloon
|
||||||
|
wo,Wolof
|
||||||
|
xh,Xhosa
|
||||||
|
yi,Yiddish
|
||||||
|
yo,Yoruba
|
||||||
|
za,Zhuang; Chuang
|
||||||
|
zh,Chinese
|
||||||
|
zu,Zulu
|
||||||
|
21
Powershell/Data/TIOBE-index.csv
Normal file
21
Powershell/Data/TIOBE-index.csv
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
Language, Popularity, Change
|
||||||
|
C, 12.54, -4.65
|
||||||
|
Python, 11.84, +3.48
|
||||||
|
Java, 11.54, -4.56
|
||||||
|
C++, 7.36, +1.41
|
||||||
|
C#, 4.33, -0.40
|
||||||
|
Visual Basic, 4.01, -0.68
|
||||||
|
JavaScript, 2.33, +0.06
|
||||||
|
PHP, 2.21, -0.05
|
||||||
|
Assembly language, 2.05, +1.09
|
||||||
|
SQL, 1.88, +0.15
|
||||||
|
Classic Visual Basic, 1.72, +1.07
|
||||||
|
Groovy, 1.29, +0.87
|
||||||
|
Ruby, 1.23, +0.25
|
||||||
|
R, 1.20, -0.99
|
||||||
|
Perl, 1.18, +0.36
|
||||||
|
Swift, 1.10, -0.35
|
||||||
|
Fortran, 1.07, +0.80
|
||||||
|
Delphi/Object Pascal, 1.06, +0.47
|
||||||
|
MATLAB, 1.05, +0.15
|
||||||
|
Go, 0.95, -0.06
|
||||||
|
178
Powershell/Data/domain-names.csv
Normal file
178
Powershell/Data/domain-names.csv
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
Domain
|
||||||
|
3sat.de
|
||||||
|
access.ing.de
|
||||||
|
accounts.google.com
|
||||||
|
activity.windows.com
|
||||||
|
airbnb.com
|
||||||
|
airbnb.de
|
||||||
|
aka.ms
|
||||||
|
aldi-nord.de
|
||||||
|
aldi-sued.de
|
||||||
|
all-in.de
|
||||||
|
allgaeuer-zeitung.de
|
||||||
|
alternate.de
|
||||||
|
api.dropboxapi.com
|
||||||
|
api.met.no
|
||||||
|
api1.origin.com
|
||||||
|
arc.msn.com
|
||||||
|
arte.tv
|
||||||
|
assets.msn.com
|
||||||
|
amazon.com
|
||||||
|
amazon.de
|
||||||
|
amazon.fr
|
||||||
|
atcsim.de
|
||||||
|
banking.ing-diba.de
|
||||||
|
bergwelten.com
|
||||||
|
bild.de
|
||||||
|
bing.com
|
||||||
|
bing.de
|
||||||
|
bing.fr
|
||||||
|
blitzortung.org
|
||||||
|
bolt.dropbox.com
|
||||||
|
br.de
|
||||||
|
catalog.gamepass.com
|
||||||
|
changelogs.ubuntu.com
|
||||||
|
chip.de
|
||||||
|
client.dropbox.com
|
||||||
|
client.wns.windows.com
|
||||||
|
clients1.google.com
|
||||||
|
clients2.google.com
|
||||||
|
clients3.google.com
|
||||||
|
clients4.google.com
|
||||||
|
contacts.google.com
|
||||||
|
d.dropbox.com
|
||||||
|
dasoertliche.de
|
||||||
|
dealer.spotify.com
|
||||||
|
deepl.com
|
||||||
|
dell.com
|
||||||
|
discord.com
|
||||||
|
discordapp.com
|
||||||
|
dhl.de
|
||||||
|
download.windowsupdate.com
|
||||||
|
dropbox.com
|
||||||
|
earth.google.com
|
||||||
|
ebay.com
|
||||||
|
ebay.de
|
||||||
|
ebay.fr
|
||||||
|
ebay-kleinanzeigen.de
|
||||||
|
ebook3000.com
|
||||||
|
facebook.com
|
||||||
|
facebook.de
|
||||||
|
facebook.fr
|
||||||
|
fleschutz.de
|
||||||
|
flightradar24.com
|
||||||
|
focus.de
|
||||||
|
fonts.google.com
|
||||||
|
fonts.googleapis.com
|
||||||
|
fonts.gstatic.com
|
||||||
|
fosbos-kempten.de
|
||||||
|
github.com
|
||||||
|
github.map.fastly.net
|
||||||
|
gmail.com
|
||||||
|
golem.de
|
||||||
|
google.com
|
||||||
|
google.de
|
||||||
|
google.fr
|
||||||
|
googleapis.com
|
||||||
|
gstatic.com
|
||||||
|
heise.de
|
||||||
|
holidaycheck.de
|
||||||
|
hornbach.de
|
||||||
|
i.ytimg.com
|
||||||
|
IEEE.org
|
||||||
|
ibm.com
|
||||||
|
icons8.com
|
||||||
|
imap.googlemail.com
|
||||||
|
ing.de
|
||||||
|
install.robertsspaceindustries.com
|
||||||
|
ipfs.io
|
||||||
|
ipv6.msftconnecttest.com
|
||||||
|
launcher2.robertsspaceindustries.com
|
||||||
|
licensing.mp.microsoft.com
|
||||||
|
lidl.de
|
||||||
|
live.github.com
|
||||||
|
live.thunderbird.net
|
||||||
|
livepatch.canonical.com
|
||||||
|
login.live.com
|
||||||
|
login.hrworks.de
|
||||||
|
longfiles.com
|
||||||
|
mail.google.com
|
||||||
|
map.blitzortung.org
|
||||||
|
maps.google.com
|
||||||
|
maps.google.de
|
||||||
|
maps.google.fr
|
||||||
|
mebis.bayern.de
|
||||||
|
microsoft.com
|
||||||
|
mozilla.org
|
||||||
|
mtalk.google.com
|
||||||
|
music.google.com
|
||||||
|
mwittrien.github.io
|
||||||
|
netbeat.de
|
||||||
|
netflix.com
|
||||||
|
news.google.com
|
||||||
|
news.google.de
|
||||||
|
news.google.fr
|
||||||
|
news.url.google.com
|
||||||
|
notube.net
|
||||||
|
ogs.google.com
|
||||||
|
opera.com
|
||||||
|
photos.google.com
|
||||||
|
pixabay.com
|
||||||
|
play.google.com
|
||||||
|
plex.tv
|
||||||
|
posaunenchor-guenzach.de
|
||||||
|
presence.teams.microsoft.com
|
||||||
|
ptbtime1.ptb.de
|
||||||
|
ptbtime2.ptb.de
|
||||||
|
ptbtime3.ptb.de
|
||||||
|
rb-allgaeuerland.de
|
||||||
|
realschule-oberguenzburg.de
|
||||||
|
redbull.tv
|
||||||
|
redhat.com
|
||||||
|
reichelt.de
|
||||||
|
robertsspaceindustries.com
|
||||||
|
schneier.com
|
||||||
|
secure.download.dm.origin.com
|
||||||
|
semonkeys.net
|
||||||
|
settings.data.microsoft.com
|
||||||
|
settings-win.data.microsoft.com
|
||||||
|
sites.google.com
|
||||||
|
slashdot.com
|
||||||
|
speedtest.net
|
||||||
|
ssl.gstatic.com
|
||||||
|
stackoverflow.com
|
||||||
|
start.thunderbird.net
|
||||||
|
static.focus.de
|
||||||
|
static.nvidiagrid.net
|
||||||
|
storage.googleapis.com
|
||||||
|
substrate.office.com
|
||||||
|
t-online.de
|
||||||
|
t0.gstatic.com
|
||||||
|
tchibo.de
|
||||||
|
teams.microsoft.com
|
||||||
|
techstage.de
|
||||||
|
telemetry.dropbox.com
|
||||||
|
tile-service.weather.microsoft.com
|
||||||
|
time.windows.com
|
||||||
|
toggl.com
|
||||||
|
toom.de
|
||||||
|
track.toggl.com
|
||||||
|
translate.google.de
|
||||||
|
twitter.com
|
||||||
|
twitter.de
|
||||||
|
ubuntu.com
|
||||||
|
ufainc.com
|
||||||
|
update.googleapis.com
|
||||||
|
wetter.com
|
||||||
|
wetter.de
|
||||||
|
wired.com
|
||||||
|
ws-kempten.de
|
||||||
|
wttr.in
|
||||||
|
www.google.com
|
||||||
|
www.googleapis.com
|
||||||
|
www.gstatic.com
|
||||||
|
www.netflix.com
|
||||||
|
www.youtube.com
|
||||||
|
youtube.com
|
||||||
|
youtube.de
|
||||||
|
zdf.de
|
||||||
|
2766
Powershell/Data/exit-codes.csv
Normal file
2766
Powershell/Data/exit-codes.csv
Normal file
File diff suppressed because it is too large
Load Diff
25
Powershell/Data/git-repos.csv
Normal file
25
Powershell/Data/git-repos.csv
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
Category,FolderName,Branch,Shallow,URL
|
||||||
|
Dev, base256unicode,master, no, "https://github.com/fleschutz/base256unicode"
|
||||||
|
Dev, bazel, master, yes, "https://github.com/bazelbuild/bazel"
|
||||||
|
Dev, cmake, master, yes, "https://github.com/Kitware/CMake"
|
||||||
|
Fun, cmatrix, master, yes, "https://github.com/abishekvashok/cmatrix"
|
||||||
|
Tool, cmark, master, yes, "https://github.com/commonmark/cmark"
|
||||||
|
Dev, CWTS, master, no, "https://github.com/fleschutz/CWTS"
|
||||||
|
Tool, elasticsearch, master, yes, "https://github.com/elastic/elasticsearch"
|
||||||
|
Tool, go-ipfs, master, yes, "https://github.com/ipfs/go-ipfs"
|
||||||
|
Tool, grafana, main, yes, "https://github.com/grafana/grafana"
|
||||||
|
Dev, llvm, master, yes, "https://github.com/llvm/llvm-project"
|
||||||
|
Math, LSS, master, yes, "https://github.com/fleschutz/LSS"
|
||||||
|
Dev, ninja, master, yes, "git://github.com/ninja-build/ninja.git"
|
||||||
|
Libs, opencv, master, yes, "https://github.com/opencv/opencv"
|
||||||
|
Tool, OSMA, master, no, "https://github.com/fleschutz/OSMA"
|
||||||
|
Shell, PowerShell, master, no, "https://github.com/fleschutz/PowerShell"
|
||||||
|
Shell, pwsh, master, yes, "https://github.com/PowerShell/PowerShell"
|
||||||
|
Dev, protobuf, master, yes, "https://github.com/protocolbuffers/protobuf"
|
||||||
|
Dev, rust, master, yes, "https://github.com/rust-lang/rust"
|
||||||
|
Tool, smartmontools, master, yes, "https://github.com/smartmontools/smartmontools"
|
||||||
|
Tool, tensorflow, master, yes, "https://github.com/tensorflow/tensorflow"
|
||||||
|
Tool, terminal, main, yes, "https://github.com/microsoft/terminal"
|
||||||
|
Dev, tinycc, mob, yes, "https://github.com/TinyCC/tinycc"
|
||||||
|
Tool, voice2json, master, yes, "https://github.com/synesthesiam/voice2json"
|
||||||
|
Tool, zfs, master, yes, "https://github.com/openzfs/zfs"
|
||||||
|
65
Powershell/Data/http-status-codes.csv
Normal file
65
Powershell/Data/http-status-codes.csv
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
"StatusCode","Type","ShortDescription","LongDescription"
|
||||||
|
"100","Informational","Continue ","The initial part of a request has been received and has not yet been rejected by the server. The server intends to send a final response after the request has been fully received and acted upon."
|
||||||
|
"101","Informational","Switching Protocols ","The server understands and is willing to comply with the client's request, via the Upgrade header field1, for a change in the application protocol being used on this connection."
|
||||||
|
"102","Informational","Processing ","An interim response used to inform the client that the server has accepted the complete request, but has not yet completed it."
|
||||||
|
"200","Success","OK ","The request has succeeded."
|
||||||
|
"201","Success","Created ","The request has been fulfilled and has resulted in one or more new resources being created."
|
||||||
|
"202","Success","Accepted ","The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place."
|
||||||
|
"203","Success","Non-authoritative Information ","The request was successful but the enclosed payload has been modified from that of the origin server's 200 OK response by a transforming proxy1."
|
||||||
|
"204","Success","No Content ","The server has successfully fulfilled the request and that there is no additional content to send in the response payload body."
|
||||||
|
"205","Success","Reset Content ","The server has fulfilled the request and desires that the user agent reset the ""document view"", which caused the request to be sent, to its original state as received from the origin server."
|
||||||
|
"206","Success","Partial Content ","The server is successfully fulfilling a range request for the target resource by transferring one or more parts of the selected representation that correspond to the satisfiable ranges found in the request's Range header field1."
|
||||||
|
"207","Success","Multi-Status ","A Multi-Status response conveys information about multiple resources in situations where multiple status codes might be appropriate."
|
||||||
|
"208","Success","Already Reported ","Used inside a DAV: propstat response element to avoid enumerating the internal members of multiple bindings to the same collection repeatedly."
|
||||||
|
"226","Success","IM Used ","The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance."
|
||||||
|
"300","Redirection","Multiple Choices ","The target resource has more than one representation, each with its own more specific identifier, and information about the alternatives is being provided so that the user (or user agent) can select a preferred representation by redirecting its request to one or more of those identifiers."
|
||||||
|
"301","Redirection","Moved Permanently ","The target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs."
|
||||||
|
"302","Redirection","Found ","The target resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client ought to continue to use the effective request URI for future requests."
|
||||||
|
"303","Redirection","See Other ","The server is redirecting the user agent to a different resource, as indicated by a URI in the Location header field, which is intended to provide an indirect response to the original request."
|
||||||
|
"304","Redirection","Not Modified ","A conditional GET or HEAD request has been received and would have resulted in a 200 OK response if it were not for the fact that the condition evaluated to false."
|
||||||
|
"305","Redirection","Use Proxy ","Defined in a previous version of this specification and is now deprecated, due to security concerns regarding in-band configuration of a proxy."
|
||||||
|
"307","Redirection","Temporary Redirect ","The target resource resides temporarily under a different URI and the user agent MUST NOT change the request method if it performs an automatic redirection to that URI."
|
||||||
|
"308","Redirection","Permanent Redirect ","The target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs."
|
||||||
|
"400","Client Error","Bad Request ","The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing)."
|
||||||
|
"401","Client Error","Unauthorized ","The request has not been applied because it lacks valid authentication credentials for the target resource."
|
||||||
|
"402","Client Error","Payment Required ","Reserved for future use."
|
||||||
|
"403","Client Error","Forbidden ","The server understood the request but refuses to authorize it."
|
||||||
|
"404","Client Error","Not Found ","The origin server did not find a current representation for the target resource or is not willing to disclose that one exists."
|
||||||
|
"405","Client Error","Method Not Allowed ","The method received in the request-line is known by the origin server but not supported by the target resource."
|
||||||
|
"406","Client Error","Not Acceptable ","The target resource does not have a current representation that would be acceptable to the user agent, according to the proactive negotiation header fields received in the request1, and the server is unwilling to supply a default representation."
|
||||||
|
"407","Client Error","Proxy Authentication Required ","Similar to 401 Unauthorized, but it indicates that the client needs to authenticate itself in order to use a proxy."
|
||||||
|
"408","Client Error","Request Timeout ","The server did not receive a complete request message within the time that it was prepared to wait."
|
||||||
|
"409","Client Error","Conflict ","The request could not be completed due to a conflict with the current state of the target resource. This code is used in situations where the user might be able to resolve the conflict and resubmit the request."
|
||||||
|
"410","Client Error","Gone ","The target resource is no longer available at the origin server and that this condition is likely to be permanent."
|
||||||
|
"411","Client Error","Length Required ","The server refuses to accept the request without a defined Content-Length1."
|
||||||
|
"412","Client Error","Precondition Failed ","One or more conditions given in the request header fields evaluated to false when tested on the server."
|
||||||
|
"413","Client Error","Payload Too Large ","The server is refusing to process a request because the request payload is larger than the server is willing or able to process."
|
||||||
|
"414","Client Error","Request-URI Too Long ","The server is refusing to service the request because the request-target1 is longer than the server is willing to interpret."
|
||||||
|
"415","Client Error","Unsupported Media Type ","The origin server is refusing to service the request because the payload is in a format not supported by this method on the target resource."
|
||||||
|
"416","Client Error","Requested Range Not Satisfiable ","None of the ranges in the request's Range header field1 overlap the current extent of the selected resource or that the set of ranges requested has been rejected due to invalid ranges or an excessive request of small or overlapping ranges."
|
||||||
|
"417","Client Error","Expectation Failed ","The expectation given in the request's Expect header field1 could not be met by at least one of the inbound servers."
|
||||||
|
"418","Client Error","I'm a teapot ","Any attempt to brew coffee with a teapot should result in the error code ""418 I'm a teapot"". The resulting entity body MAY be short and stout."
|
||||||
|
"421","Client Error","Misdirected Request ","The request was directed at a server that is not able to produce a response. This can be sent by a server that is not configured to produce responses for the combination of scheme and authority that are included in the request URI."
|
||||||
|
"422","Client Error","Unprocessable Entity ","The server understands the content type of the request entity (hence a 415 Unsupported Media Type status code is inappropriate), and the syntax of the request entity is correct (thus a 400 Bad Request status code is inappropriate) but was unable to process the contained instructions."
|
||||||
|
"423","Client Error","Locked ","The source or destination resource of a method is locked."
|
||||||
|
"424","Client Error","Failed Dependency ","The method could not be performed on the resource because the requested action depended on another action and that action failed."
|
||||||
|
"426","Client Error","Upgrade Required ","The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol."
|
||||||
|
"428","Client Error","Precondition Required ","The origin server requires the request to be conditional."
|
||||||
|
"429","Client Error","Too Many Requests ","The user has sent too many requests in a given amount of time (""rate limiting"")."
|
||||||
|
"431","Client Error","Request Header Fields Too Large ","The server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields."
|
||||||
|
"444","Client Error","Connection Closed Without Response ","A non-standard status code used to instruct nginx to close the connection without sending a response to the client, most commonly used to deny malicious or malformed requests."
|
||||||
|
"451","Client Error","Unavailable For Legal Reasons ","The server is denying access to the resource as a consequence of a legal demand."
|
||||||
|
"499","Client Error","Client Closed Request ","A non-standard status code introduced by nginx for the case when a client closes the connection while nginx is processing the request."
|
||||||
|
"500","Server Error","Internal Server Error ","The server encountered an unexpected condition that prevented it from fulfilling the request."
|
||||||
|
"501","Server Error","Not Implemented ","The server does not support the functionality required to fulfill the request."
|
||||||
|
"502","Server Error","Bad Gateway ","The server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request."
|
||||||
|
"503","Server Error","Service Unavailable ","The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay."
|
||||||
|
"504","Server Error","Gateway Timeout ","The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request."
|
||||||
|
"505","Server Error","HTTP Version Not Supported ","The server does not support, or refuses to support, the major version of HTTP that was used in the request message."
|
||||||
|
"506","Server Error","Variant Also Negotiates ","The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process."
|
||||||
|
"507","Server Error","Insufficient Storage ","The method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request."
|
||||||
|
"508","Server Error","Loop Detected ","The server terminated an operation because it encountered an infinite loop while processing a request with ""Depth: infinity"". This status indicates that the entire operation failed."
|
||||||
|
"510","Server Error","Not Extended ","The policy for accessing the resource has not been met in the request. The server should send back all the information necessary for the client to issue an extended request."
|
||||||
|
"511","Server Error","Network Authentication Required ","The client needs to authenticate to gain network access."
|
||||||
|
"599","Server Error","Network Connect Timeout Error ","This status code is not specified in any RFCs, but is used by some HTTP proxies to signal a network connect timeout behind the proxy to a client in front of the proxy."
|
||||||
|
|
||||||
|
69
Powershell/Data/jokes.csv
Normal file
69
Powershell/Data/jokes.csv
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
Joke
|
||||||
|
"Chuck Norris doesnt read books. He stares them down until he gets the information he wants."
|
||||||
|
"Time waits for no man. Unless that man is Chuck Norris."
|
||||||
|
"If you spell Chuck Norris in Scrabble, you win. Forever."
|
||||||
|
"Chuck Norris breathes air five times a day."
|
||||||
|
"In the Beginning there was nothing then Chuck Norris roundhouse kicked nothing and told it to get a job."
|
||||||
|
"Chuck Norris has a mug of nails instead of coffee in the morning."
|
||||||
|
"If Chuck Norris were to travel to an alternate dimension in which there was another Chuck Norris and they both fought, they would both win."
|
||||||
|
"The dinosaurs looked at Chuck Norris the wrong way once. You know what happened to them."
|
||||||
|
"Chuck Norris tears cure cancer. Too bad he has never cried."
|
||||||
|
"Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light"
|
||||||
|
"Since 1940, the year Chuck Norris was born, roundhouse kick related deaths have increased 13,000 percent."
|
||||||
|
"Chuck Norris does not own a stove, oven, or microwave , because revenge is a dish best served cold."
|
||||||
|
"Chuck Norris does not sleep. He waits."
|
||||||
|
"There is no chin behind Chuck Norris beard. There is only another fist."
|
||||||
|
"The chief export of Chuck Norris is pain."
|
||||||
|
"Chuck Norris recently had the idea to sell his pee as a canned beverage. Its now called Red Bull."
|
||||||
|
"If paper beats rock, rock beats scissors, and scissors beats paper, what beats all 3 at the same time? Chuck Norris."
|
||||||
|
"On the 7th day, God rested Chuck Norris took over."
|
||||||
|
"Chuck Norris can dribble a bowling ball."
|
||||||
|
"Chuck Norris drinks napalm to fight his heartburn."
|
||||||
|
"Chuck Norris roundhouse kick is so powerful, it can be seen from outer space by the naked eye."
|
||||||
|
"If you want a list of Chuck Norris enemies, just check the extinct species list."
|
||||||
|
"Chuck Norris has never blinked in his entire life. Never."
|
||||||
|
"Chuck Norris does not use spell check. If he happens to misspell a word, Oxford will change the spelling."
|
||||||
|
"Some kids pee their name in the snow. Chuck Norris can pee his name into concrete."
|
||||||
|
"Chuck Norris counted to infinity twice."
|
||||||
|
"Chuck Norris can speak Braille."
|
||||||
|
"Chuck Norris can have both feet on the ground and kick butt at the same time."
|
||||||
|
"Chuck Norris can do a wheelie on a unicycle."
|
||||||
|
"Chuck Norris stands faster than anyone can run."
|
||||||
|
"Once a cobra bit Chuck Norris leg. After five days of excruciating pain, the cobra died."
|
||||||
|
"Chuck Norris once won a game of Connect Four in three moves."
|
||||||
|
"Champions are the breakfast of Chuck Norris."
|
||||||
|
"When the Boogeyman goes to sleep every night he checks his closet for Chuck Norris."
|
||||||
|
"Chuck Norris can slam revolving doors."
|
||||||
|
"Chuck Norris does not hunt because the word hunting implies the possibility of failure. Chuck Norris goes killing."
|
||||||
|
"The dark is afraid of Chuck Norris."
|
||||||
|
"Chuck Norris makes onions cry."
|
||||||
|
"Death once had a near-Chuck-Norris experience."
|
||||||
|
"When Chuck Norris writes, he makes paper bleed."
|
||||||
|
"Chuck Norris can strangle you with a cordless phone."
|
||||||
|
"Chuck Norris never retreats; He just attacks in the opposite direction."
|
||||||
|
"Chuck Norris can build a snowman out of rain."
|
||||||
|
"Chuck Norris can drown a fish."
|
||||||
|
"When Chuck Norris enters a room, he doesnt turn the lights on, he turns the dark off."
|
||||||
|
"The only time Chuck Norris was ever wrong was when he thought he had made a mistake."
|
||||||
|
"Chuck Norris is the only person that can punch a cyclops between the eye."
|
||||||
|
"Chuck Norris used to beat up his shadow because it was following to close. It now stands 15 feet behind him."
|
||||||
|
"Outer space exists because its afraid to be on the same planet with Chuck Norris."
|
||||||
|
"When Chuck Norris does a pushup, he's pushing the Earth down."
|
||||||
|
"Chuck Norris doesnt wear a watch. He decides what time it is."
|
||||||
|
"Chuck Norris does not get frostbite. Chuck Norris bites frost."
|
||||||
|
"Chuck Norris spices up his steaks with pepper spray."
|
||||||
|
"The Great Wall of China was originally created to keep Chuck Norris out. It didn't work."
|
||||||
|
"Chuck Norris can get in a bucket and lift it up with himself in it."
|
||||||
|
"Chuck Norris doesn't shower, he only takes blood baths."
|
||||||
|
"Chuck Norris can divide by zero."
|
||||||
|
"Chuck Norris once kicked a horse in the chin. Its descendants are now known as giraffes."
|
||||||
|
"When Chuck Norris does division, there are no remainders."
|
||||||
|
"It takes Chuck Norris 20 minutes to watch '60 Minutes'."
|
||||||
|
"Chuck Norris once went skydiving, but promised never to do it again. One Grand Canyon is enough."
|
||||||
|
"We live in an expanding universe. All of it is trying to get away from Chuck Norris."
|
||||||
|
"Chuck Norris beat the sun in a staring contest."
|
||||||
|
"Chuck Norris can clap with one hand."
|
||||||
|
"Chuck Norris doesn't need to shave. His beard is scared to grow."
|
||||||
|
"Chuck Norris invented airplanes because he was tired of being the only person that could fly."
|
||||||
|
"Freddy Krueger has nightmares about Chuck Norris."
|
||||||
|
"Chuck Norris can start a fire with an ice cube."
|
||||||
|
29
Powershell/Data/matrix.csv
Normal file
29
Powershell/Data/matrix.csv
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
|
||||||
|
" ","P"," "," "," "," ","H"," "," "," ","R"," "," "," "," "," "," "," ","B"," "," "," "," "," ","M"
|
||||||
|
" ","O"," "," "," "," ","A"," "," "," ","E"," "," "," "," "," "," "," ","L"," "," "," "," "," ","A"
|
||||||
|
" ","W"," "," "," "," ","V"," "," "," ","D"," "," "," "," "," "," "," ","U"," "," "," "," "," ","T"
|
||||||
|
" ","E"," "," "," "," ","E"," "," "," "," "," "," "," "," "," "," "," ","E"," "," "," "," "," ","R"
|
||||||
|
" ","R"," "," "," "," "," "," "," "," ","P"," "," "," "," "," "," "," "," "," "," "," "," "," ","I"
|
||||||
|
" ","S"," "," "," "," ","F"," "," "," ","I"," "," "," "," "," "," "," ","P"," "," "," "," "," ","X"
|
||||||
|
" ","H"," "," "," "," ","U"," "," "," ","L"," "," "," "," "," "," "," ","I"," "," "," "," "," "," "
|
||||||
|
" ","E"," "," "," "," ","N"," "," "," ","L"," "," "," "," "," "," "," ","L"," "," "," "," "," "," "
|
||||||
|
" ","L"," "," "," "," "," "," "," "," ","?"," "," "," "," "," "," "," ","L"," "," "," "," "," "," "
|
||||||
|
" ","L"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","?"," "," "," "," "," "," "
|
||||||
|
" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" ","R"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" ","U"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" ","L"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" ","E"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" ","S"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
|
||||||
|
13297
Powershell/Data/ports.csv
Normal file
13297
Powershell/Data/ports.csv
Normal file
File diff suppressed because it is too large
Load Diff
217
Powershell/Data/scripts.csv
Normal file
217
Powershell/Data/scripts.csv
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
Script,Description
|
||||||
|
add-firewall-rules.ps1, adds firewall rules to the given executables (needs admin rights)
|
||||||
|
add-memo.ps1, adds the given memo text to $HOME/Memos.csv
|
||||||
|
cd-desktop.ps1, go to the user's desktop folder
|
||||||
|
cd-docs.ps1, go to the user's documents folder
|
||||||
|
cd-downloads.ps1, go to the user's downloads folder
|
||||||
|
cd-dropbox.ps1, go to the user's Dropbox folder
|
||||||
|
cd-home.ps1, go to the user's home folder
|
||||||
|
cd-music.ps1, go to the user's music folder
|
||||||
|
cd-onedrive.ps1, go to the user's OneDrive folder
|
||||||
|
cd-pics.ps1, go to the user's pictures folder
|
||||||
|
cd-recycle-bin.ps1, go to the user's recycle bin folder
|
||||||
|
cd-repos.ps1, go to the user's Git repositories folder
|
||||||
|
cd-root.ps1, go to the root directory (C: on Windows)
|
||||||
|
cd-scripts.ps1, go to the PowerShell Scripts folder
|
||||||
|
cd-up.ps1, go one directory level up
|
||||||
|
cd-up2.ps1, go two directory levels up
|
||||||
|
cd-up3.ps1, go three directory levels up
|
||||||
|
cd-up4.ps1, go four directory levels up
|
||||||
|
cd-videos.ps1, go to the user's videos folder
|
||||||
|
check-cpu-temp.ps1, checks the CPU temperature
|
||||||
|
check-dns-resolution.ps1, checks the DNS resolution with frequently used domain names
|
||||||
|
check-drive-space.ps1, checks the given drive for free space left
|
||||||
|
check-file-system.ps1, checks the validity of the file system (needs admin rights)
|
||||||
|
check-health.ps1, checks the system health
|
||||||
|
check-ipv4-address.ps1, checks the given IPv4 address for validity
|
||||||
|
check-ipv6-address.ps1, checks the given IPv6 address for validity
|
||||||
|
check-mac-address.ps1, checks the given MAC address for validity
|
||||||
|
check-ping.ps1, checks the ping latency to the internet
|
||||||
|
check-swap-space.ps1, checks the swap space for free space left
|
||||||
|
check-symlinks.ps1, checks every symlink in the given directory tree
|
||||||
|
check-weather.ps1, checks the current weather for critical values
|
||||||
|
check-windows-system-files.ps1, checks the validity of the Windows system files
|
||||||
|
check-xml-file.ps1, checks the given XML file for validity
|
||||||
|
cherry-picker.ps1, cherry-picks a Git commit into multiple branches
|
||||||
|
clean-repo.ps1, cleans the current/given Git repository from untracked files (including submodules)
|
||||||
|
clean-repos.ps1, cleans all Git repositories under the current/given directory from untracked files (including submodules)
|
||||||
|
clear-recycle-bin.ps1, removes the content of the recycle bin folder (can not be undo!)
|
||||||
|
clone-repos.ps1, clones well-known Git repositories
|
||||||
|
close-calculator.ps1, closes the calculator program gracefully
|
||||||
|
close-chrome.ps1, closes Google Chrome gracefully
|
||||||
|
close-cortana.ps1, closes Cortana gracefully
|
||||||
|
close-edge.ps1, closes Microsoft Edge gracefully
|
||||||
|
close-file-explorer.ps1, closes Microsoft File Explorer gracefully
|
||||||
|
close-program.ps1, closes the given program gracefully
|
||||||
|
close-system-settings.ps1, closes the System Settings gracefully
|
||||||
|
close-thunderbird.ps1, closes Mozilla Thunderbird gracefully
|
||||||
|
close-vlc.ps1, closes the VLC media player gracefully
|
||||||
|
close-windows-terminal.ps1, closes Windows Terminal gracefully
|
||||||
|
configure-git.ps1, sets up the Git user configuration
|
||||||
|
convert-csv2txt.ps1, converts the given CSV file into a text list
|
||||||
|
convert-mysql2csv.ps1, converts the MySQL database table to a CSV file
|
||||||
|
convert-ps2bat.ps1, converts PowerShell script(s) to .bat files
|
||||||
|
convert-sql2csv.ps1, converts the SQL database table to a CSV file
|
||||||
|
convert-txt2wav.ps1, converts text into a audio .WAV file
|
||||||
|
create-branch.ps1, creates a new branch in the current/given Git repository
|
||||||
|
create-shortcut.ps1, creates a shortcut
|
||||||
|
create-symlink.ps1, creates a symbolic link
|
||||||
|
create-tag.ps1, creates a new tag in the current/given Git repository
|
||||||
|
daily-tasks.sh, execute PowerShell scripts automatically as daily tasks (Linux only)
|
||||||
|
decrypt-file.ps1, decrypts the given file
|
||||||
|
display-time.ps1, displays the current time for 10 seconds by default
|
||||||
|
download-dir.ps1, downloads a directory tree from the given URL
|
||||||
|
download-file.ps1, downloads a file from the given URL
|
||||||
|
edit.ps1, edits the given file with the built-in text editor
|
||||||
|
enable-crash-dumps.ps1, enables the writing of crash dumps
|
||||||
|
enable-god-mode.ps1, enables the god mode (adds a new icon to the desktop)
|
||||||
|
enable-ssh-client.ps1, enables the SSH client (needs admin rights)
|
||||||
|
enable-ssh-server.ps1, enables the SSH server (needs admin rights)
|
||||||
|
encrypt-file.ps1, encrypts the given file
|
||||||
|
fetch-repo.ps1, fetches updates for the current/given Git repository (including submodules)
|
||||||
|
fetch-repos.ps1, fetches updates for all Git repositories under the current/given directory (including submodules)
|
||||||
|
generate-qrcode.ps1, generates a QR code
|
||||||
|
hibernate.ps1, enables hibernate mode for the local computer (needs admin rights)
|
||||||
|
inspect-exe.ps1, prints basic information of the given executable file
|
||||||
|
install-google-chrome.ps1, installs the Google Chrome browser
|
||||||
|
install-signal-cli.ps1, installs signal-cli from github.com/AsamK/signal-cli
|
||||||
|
introduce-powershell.ps1, introduces PowerShell to new users
|
||||||
|
list-aliases.ps1, lists all PowerShell aliases
|
||||||
|
list-anagrams.ps1, lists all anagrams of the given word
|
||||||
|
list-automatic-variables.ps1, lists the automatic variables of PowerShell
|
||||||
|
list-branches.ps1, lists all branches in the current/given Git repository
|
||||||
|
list-cheat-sheet.ps1, lists the PowerShell cheat sheet
|
||||||
|
list-city-weather.ps1, lists the current weather of cities worldwide (east to west)
|
||||||
|
list-commits.ps1, lists all commits in the current/given Git repository
|
||||||
|
list-clipboard.ps1, lists the contents of the clipboard
|
||||||
|
list-credits.ps1, shows the credits
|
||||||
|
list-dir.ps1, lists the directory content (formatted in columns)
|
||||||
|
list-dir-tree.ps1, lists the directory tree content
|
||||||
|
list-drives.ps1, lists all drives
|
||||||
|
list-environment-variables.ps1, lists all environment variables
|
||||||
|
list-emojis.ps1, lists the emojis of Unicode 13.0
|
||||||
|
list-empty-dirs.ps1, lists empty subfolders within the given directory tree
|
||||||
|
list-empty-files.ps1, lists empty files within the given directory tree
|
||||||
|
list-files.ps1, lists all files in the given folder and also in every subfolder
|
||||||
|
list-fritzbox-calls.ps1, lists the FRITZ!Box calls
|
||||||
|
list-fritzbox-devices.ps1, lists FRITZ!Box's known devices
|
||||||
|
list-hidden-files.ps1, lists hidden files within the given directory tree
|
||||||
|
list-installed-apps.ps1, lists the installed Windows Store apps
|
||||||
|
list-installed-software.ps1, lists the installed software (except Windows Store apps)
|
||||||
|
list-latest-tag.ps1, lists the latest tag on the current branch in a Git repository
|
||||||
|
list-memos.ps1, lists the memos at $HOME/Memos.csv
|
||||||
|
list-unused-files.ps1, lists unused files in a directory tree
|
||||||
|
list-cmdlets.ps1, lists the PowerShell cmdlets
|
||||||
|
list-earthquakes.ps1, lists earthquakes with magnitude >= 6.0 for the last 30 days
|
||||||
|
list-modules.ps1, lists the PowerShell modules
|
||||||
|
list-mysql-tables.ps1, lists the MySQL server tables
|
||||||
|
list-network-shares.ps1, lists the network shares of the local computer
|
||||||
|
list-news.ps1, lists the latest news
|
||||||
|
list-os-releases.ps1, lists operating system releases and download URL
|
||||||
|
list-os-updates.ps1, lists operating system updates
|
||||||
|
list-printers.ps1, lists all printer known to the computer
|
||||||
|
list-processes.ps1, lists the local computer processes
|
||||||
|
list-profiles.ps1, lists your PowerShell profiles
|
||||||
|
list-random-passwords.ps1, prints a list of random passwords
|
||||||
|
list-random-pins.ps1, prints a list of random PIN's
|
||||||
|
list-recycle-bin.ps1, lists the content of the recycle bin folder
|
||||||
|
list-scripts.ps1, lists all PowerShell scripts in this repository
|
||||||
|
list-services.ps1, lists the services on the local computer
|
||||||
|
list-sql-tables.ps1, lists the SQL server tables
|
||||||
|
list-submodules.ps1, lists the submodules of the current/given Git repository
|
||||||
|
list-system-info.ps1, lists system information on the local computer
|
||||||
|
list-tags.ps1, lists all tags in the current/given Git repository
|
||||||
|
list-tasks.ps1, lists all Windows scheduler tasks
|
||||||
|
list-timezone.ps1, lists the current time zone details
|
||||||
|
list-timezones.ps1, lists all time zones available
|
||||||
|
list-tiobe-index.ps1, lists the TIOBE index of top programming languages
|
||||||
|
list-user-groups.ps1, lists the user groups on the local computer
|
||||||
|
list-weather.ps1, lists the hourly weather
|
||||||
|
list-workdir.ps1, lists the current working directory
|
||||||
|
locate-city.ps1, prints the geographic location of the given city
|
||||||
|
locate-ipaddress.ps1, prints the geographic location of the given IP address
|
||||||
|
locate-zip-code.ps1, prints the geographic location of the given zip-code
|
||||||
|
MD5.ps1, prints the MD5 checksum of the given file
|
||||||
|
make-install.ps1, installs built executables and libs to the installation directory
|
||||||
|
make-repo.ps1, builds the current/given Git repository
|
||||||
|
make-repos.ps1, builds all Git repositories under the current/given directory
|
||||||
|
moon.ps1, prints the current moon phase
|
||||||
|
mute-audio.ps1, mutes audio
|
||||||
|
next-joke.ps1], gets the next random Juck Norris joke
|
||||||
|
open-browser.ps1, starts the default Web browser
|
||||||
|
open-calculator.ps1, starts the calculator program
|
||||||
|
open-email-client.ps1, starts the default email client
|
||||||
|
open-file-explorer.ps1, starts the Microsoft File Explorer
|
||||||
|
open-recycle-bin.ps1, starts the File Explorer with the recycle bin folder
|
||||||
|
play-beep.ps1, plays a beep sound
|
||||||
|
play-files.ps1, plays the given audio files
|
||||||
|
play-mission-impossible.ps1, plays the Mission Impossible theme
|
||||||
|
play-m3u.ps1, plays the given playlist (M3U file format)
|
||||||
|
play-mp3.ps1, plays the given sound file (MP3 file format)
|
||||||
|
play-super-mario.ps1, plays the Super Mario Intro
|
||||||
|
play-the-imperial-march.ps1, plays the Imperial March (Star Wars)
|
||||||
|
poweroff.ps1, halts the local computer (needs admin rights)
|
||||||
|
pull-repo.ps1, pulls updates for the current/given Git repository (including submodules)
|
||||||
|
pull-repos.ps1, pulls updates for all Git repositories under the current/given directory (including submodules)
|
||||||
|
query-smart-data.ps1, queries the S.M.A.R.T. data of your HDD/SSD's and saves it to the current/given directory
|
||||||
|
new-email.ps1, starts the default email client to write a new email
|
||||||
|
reboot.ps1, reboots the local computer (needs admin rights)
|
||||||
|
reboot-fritzbox.ps1, reboots the FRITZ!box device
|
||||||
|
remove-empty-dirs.ps1, removes empty subfolders within the given directory tree
|
||||||
|
search-filename.ps1, searches the directory tree for filenames by given pattern
|
||||||
|
search-files.ps1, searches the given pattern in the given files
|
||||||
|
scan-ports.ps1, scans the network for open/closed ports
|
||||||
|
send-email.ps1, sends an email message
|
||||||
|
send-tcp.ps1, sends a TCP message to the given IP address and port
|
||||||
|
send-udp.ps1, sends a UDP datagram message to the given IP address and port
|
||||||
|
set-profile.ps1, updates your PowerShell user profile
|
||||||
|
set-timer.ps1, sets a timer for a countdown
|
||||||
|
set-wallpaper.ps1, sets the given image as wallpaper
|
||||||
|
SHA1.ps1, prints the SHA1 checksum of the given file
|
||||||
|
SHA256.ps1, prints the SHA256 checksum of the given file
|
||||||
|
simulate-matrix.ps1, simulates the Matrix (fun)
|
||||||
|
simulate-presence.ps1, simulates the human presence against burglars
|
||||||
|
speak-checklist.ps1, speaks the given checklist by text-to-speech (TTS)
|
||||||
|
speak-countdown.ps1, starts a countdown by text-to-speech (TTS)
|
||||||
|
speak-date.ps1, speaks the current date by text-to-speech (TTS)
|
||||||
|
speak-english.ps1, speaks the given text with an English text-to-speech (TTS) voice
|
||||||
|
speak-epub.ps1, speaks the content of the given Epub file by text-to-speech (TTS)
|
||||||
|
speak-file.ps1, speaks the content of the given text file by text-to-speech (TTS)
|
||||||
|
speak-german.ps1, speaks the given text with a German text-to-speech (TTS) voice
|
||||||
|
speak-joke.ps1, speaks the next joke by text-to-speech (TTS)
|
||||||
|
speak-test.ps1, performs a speak test by text-to-speech (TTS)
|
||||||
|
speak-text.ps1, speaks the given text by text-to-speech (TTS)
|
||||||
|
speak-time.ps1, speaks the current time by text-to-speech (TTS)
|
||||||
|
start-ipfs-server.ps1, starts a local IPFS server
|
||||||
|
switch-branch.ps1, switches the branch in the current/given Git repository (including submodules)
|
||||||
|
switch-shelly1.ps1, switches a Shelly1 device in the local network
|
||||||
|
sync-repo.ps1, synchronizes a Git repository by push & pull (including submodules)
|
||||||
|
take-screenshot.ps1, takes a single screenshot
|
||||||
|
take-screenshots.ps1, takes multiple screenshots
|
||||||
|
translate-file.ps1, translates the given text file into another language
|
||||||
|
translate-files.ps1, translates the given text files into any supported language
|
||||||
|
translate-text.ps1, translates the given text into other languages
|
||||||
|
turn-volume-up.ps1, turns the audio volume up (+10% by default)
|
||||||
|
turn-volume-down.ps1, turns the audio volume down (-10% by default)
|
||||||
|
unmute-audio.ps1, unmutes audio
|
||||||
|
upload-file.ps1, uploads the local file to the given FTP server
|
||||||
|
voice-control.ps1, executes the PowerShell scripts by voice
|
||||||
|
wakeup.ps1, sends a magic packet to the given computer, waking him up
|
||||||
|
weather.ps1, prints the current weather forecast
|
||||||
|
weather-report.ps1, prints the local weather report
|
||||||
|
what-is.ps1, prints a description of the given abbreviation
|
||||||
|
write-animated.ps1, writes animated text
|
||||||
|
write-big.ps1, writes the given text in big letters
|
||||||
|
write-blue.ps1, writes the given text in a blue foreground color
|
||||||
|
write-braille.ps1, writes the given text in Braille
|
||||||
|
write-green.ps1, writes the given text in a green foreground color
|
||||||
|
write-lowercase.ps1, writes the given text in lowercase letters
|
||||||
|
write-marquee.ps1, writes the given text as marquee
|
||||||
|
write-morse-code.ps1, writes the given text in Morse code
|
||||||
|
write-motd.ps1, writes the message of the day (MOTD)
|
||||||
|
write-red.ps1, writes the given text in a red foreground color
|
||||||
|
write-rot13.ps1, encodes or decodes the given text with ROT13
|
||||||
|
write-typewriter.ps1, writes the given text with the typewriter effect
|
||||||
|
write-uppercase.ps1, writes the given text in uppercase letters
|
||||||
|
write-vertical.ps1, writes the given text in vertical direction
|
||||||
|
zip-dir.ps1, creates a zip archive of the given directory
|
||||||
|
21
Powershell/Data/wordcities-license.txt
Normal file
21
Powershell/Data/wordcities-license.txt
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
This license is a legal document designed to protect your rights and the rights of the Pareto Software, LLC, the owner of Simplemaps.com. Please read it carefully. Purchasing or downloading a data product constitutes acceptance of this license.
|
||||||
|
|
||||||
|
Description of Product and Parties: This license is a contract between you (hereafter, the Customer) and Pareto Software, LLC (hereafter, the Provider) regarding the use and/or sale of an collection of geographic data (hereafter, the Database).
|
||||||
|
|
||||||
|
Ownership of Database: All rights to the Database are owned by the Provider. The Database is a cleaned and curated collection of geographic facts and the Provider retains all rights to the Database afforded by the law. Ownership of any intellectual property generated by the Provider while performing custom modifications to the Database for a Customer (with or without payment) is retained by the Provider.
|
||||||
|
|
||||||
|
License: Customers who purchase a license are allowed to use the database for projects that benefit their organization or that their organization oversees. Attribution is not required. The Customer is allowed to query the database to power privately or publicly facing applications. The Customer is allowed to make copies and backups of the data. The Customer may not publicly redistribute the Database without prior written permission. Customers can transfer their license to a third-party, at the sole discretion of the Provider, by submitting a request via email.
|
||||||
|
|
||||||
|
Free US Zip Code Database: The Provider offers a free version of the US Zip Code Database. This Database is offered free of charge conditional on a link back to https://simplemaps.com/data/us-zips. This backlink must come from a public webpage where the Customer is using the data. If the Customer uses the data internally, the backlink must be placed on the organization's website on a page that can be easily found though links on the root domain. The link must be clearly visible to the human eye. The backlink must be placed before the Customer uses the Database in production.
|
||||||
|
|
||||||
|
Free US Cities Database: The Provider offers a free version of the US Cities Database. This Database is offered free of charge conditional on a link back to https://simplemaps.com/data/us-cities. This backlink must come from a public webpage where the Customer is using the data. If the Customer uses the data internally, the backlink must be placed on the organization's website on a page that can be easily found though links on the root domain. The link must be clearly visible to the human eye. The backlink must be placed before the Customer uses the Database in production.
|
||||||
|
|
||||||
|
Basic World Cities Database: The Provider offers a Basic World Cities Database free of charge. This database is licensed under the Creative Commons Attribution 4.0 license as described at: https://creativecommons.org/licenses/by/4.0/.
|
||||||
|
|
||||||
|
Comprehensive and Pro World Cities Database Density Data: The Comprehensive and Pro World Cities Databases includes density estimates from The Center for International Earth Science Information Network - CIESIN - Columbia University. 2016. Gridded Population of the World, Version 4 (GPWv4): Population Count. Palisades, NY: NASA Socioeconomic Data and Applications Center (SEDAC). http://dx.doi.org/10.7927/H4X63JVC. Accessed June 2017. The density estimates are include under the Creative Commons Attribution 4.0 International License. The Provider places no additional restrictions on the use or distribution of the density data.
|
||||||
|
|
||||||
|
Guarantee: The Provider guarantees that for the period of thirty (30) days from the purchase of a License that the Customer shall, upon request, be refunded their actual purchase price within a reasonable period of time. The Customer acknowledges that receipt of a refund constitutes a termination of their License to use the Database. In the event of a Refund, the Customer promises to delete the Database immediately. Refunds after the period of thirty (30) days shall be at the sole discretion of the Provider.
|
||||||
|
|
||||||
|
LIMITATION OF LIABILITY: THE DATABASE IS SOLD "AS IS" AND "WITH ALL FAULTS". THE PROVIDER MAKES NO WARRANTY THAT IT IS FREE OF DEFECTS OR IS SUITABLE FOR ANY PARTICULAR PURPOSE. IN NO EVENT SHALL THE PROVIDER BE RESPONSIBLE FOR LOSS OR DAMAGES ARRISING FROM THE INSTALLATION OR USE OF THE DATABASE, INCLUDING BUT NOT LIMITED TO ANY INDIRECT, PUNITIVE, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES. THE CUSTOMER IS SOLELY RESPONSIBLE FOR ENSURING THAT THEIR USE OF THE DATABASE IS IN ACCORDANCE WITH THE LAW OF THEIR JURISDICTION.
|
||||||
|
|
||||||
|
PROHIBITION OF ILLEGAL USE: USE OF THE DATABASE WHICH IS CONTRARY TO THE LAW IS PROHIBITED, AND IMMEDIATELY TERMINATES THE CUSTOMER'S LICENSE TO USE THE DATABASE.
|
||||||
26563
Powershell/Data/worldcities.csv
Normal file
26563
Powershell/Data/worldcities.csv
Normal file
File diff suppressed because it is too large
Load Diff
1129901
Powershell/Data/zip-codes.csv
Normal file
1129901
Powershell/Data/zip-codes.csv
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Powershell/Misc/Add_ps1_to_New_context_menu.reg
Normal file
BIN
Powershell/Misc/Add_ps1_to_New_context_menu.reg
Normal file
Binary file not shown.
82
Powershell/Misc/FAQ.md
Normal file
82
Powershell/Misc/FAQ.md
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
PowerShell FAQ
|
||||||
|
==============
|
||||||
|
|
||||||
|
What is PowerShell?
|
||||||
|
-------------------
|
||||||
|
PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language.
|
||||||
|
|
||||||
|
Why use PowerShell?
|
||||||
|
-------------------
|
||||||
|
* **it's powerful**: fully control your computer
|
||||||
|
* **it's cross-platform**: available for Linux, Mac OS and Windows
|
||||||
|
* **it's open-source and free**: see the Github repository at https://github.com/PowerShell/PowerShell
|
||||||
|
* **it's easy to learn**: see the tutorial at https://www.guru99.com/powershell-tutorial.html
|
||||||
|
* **it's fully documented**: see the official docs at https://docs.microsoft.com/en-us/powershell/
|
||||||
|
|
||||||
|
How to get PowerShell?
|
||||||
|
----------------------
|
||||||
|
* **On Windows 7 and newer** PowerShell is provided by default. However, script execution is **not allowed by default** (execution policy is "restricted"). To enable this, enter as administrator:
|
||||||
|
```
|
||||||
|
$ Set-ExecutionPolicy RemoteSigned
|
||||||
|
```
|
||||||
|
* **On CentOS, Debian, Docker, Fedora, macOS, openSUSE, Red Hat, Ubuntu** visit https://github.com/PowerShell/PowerShell for installation.
|
||||||
|
* **Want to use Snaps?** Install the PowerShell snap by executing:
|
||||||
|
```
|
||||||
|
$ snap install PowerShell
|
||||||
|
$ ln -s /snap/bin/pwsh /usr/bin/pwsh
|
||||||
|
```
|
||||||
|
|
||||||
|
How to get the PowerShell Scripts?
|
||||||
|
----------------------------------
|
||||||
|
* Git users execute: `$ git clone https://github.com/fleschutz/PowerShell`
|
||||||
|
* otherwise download it from: https://github.com/fleschutz/PowerShell/archive/master.zip
|
||||||
|
|
||||||
|
|
||||||
|
Why do some Scripts show gibberish characters?
|
||||||
|
----------------------------------------------
|
||||||
|
Those PowerShell scripts are using Unicode input & output! Use a modern console supporting UTF-8 such as Windows Terminal, please.
|
||||||
|
|
||||||
|
|
||||||
|
How to set PowerShell as My Default Shell on Linux?
|
||||||
|
---------------------------------------------------
|
||||||
|
Make sure PowerShell is installed, then execute: `chsh -s /usr/bin/pwsh <username>`. In case you experience an "invalid shell" error, add "/usr/bin/pwsh" to /etc/shells.
|
||||||
|
|
||||||
|
|
||||||
|
How to add the Scripts to the Search Path?
|
||||||
|
------------------------------------------
|
||||||
|
Want to use the PowerShell scripts everywhere on the command-line? Then you need to add the Scripts/ subfolder to the search path:
|
||||||
|
|
||||||
|
* **On Linux using Bash:** edit .profile in your home directory and add the line: PATH="$PATH:/path/to/PowerShell/Scripts"
|
||||||
|
* **On Windows:** open the environment variables dialogue and add the full path to Scripts/ to the system environment variable "Path"
|
||||||
|
|
||||||
|
|
||||||
|
How to use PowerShell in Context Menus?
|
||||||
|
---------------------------------------
|
||||||
|
* to enable "right-click > New > Windows PowerShell Script" execute `Add_ps1_to_New_context_menu.reg` in subfolder [Misc/](Misc)
|
||||||
|
* to disable this execute `Remove_ps1_from_New_context_menu.reg` in subfolder [Misc/](Misc)
|
||||||
|
|
||||||
|
|
||||||
|
How to edit the PowerShell Scripts?
|
||||||
|
-----------------------------------
|
||||||
|
* use *PowerShell ISE* (Integrated Scripting Environment) to write, test and debug scripts (available for free on Windows only).
|
||||||
|
* use *Visual Studio Code* supporting syntax highlighting, on-the-fly problem checking and an integrated PowerShell Console (available for free on Linux, Mac OS and Windows).
|
||||||
|
* or simply use your *favorite text editor*
|
||||||
|
|
||||||
|
How to write good PowerShell Scripts?
|
||||||
|
-------------------------------------
|
||||||
|
Good PowerShell scripts are user-friendly and platform-independant. As a guideline follow these rules, please:
|
||||||
|
|
||||||
|
1. the filename is named using the `<verb>-<object>.ps1` scheme
|
||||||
|
2. the encoding is UTF-8-BOM to support and use Unicode characters (including emojis where appropriate)
|
||||||
|
3. the script has execute file permissions: chmod a+rx <file> (for Linux support)
|
||||||
|
4. provide a comment-based help with syntax, description, link, author, and license
|
||||||
|
5. check the requirements (e.g. #Requires -RunAsAdministrator, or #Requires -Version 3)
|
||||||
|
6. prefer command-line options, else ask the user for help
|
||||||
|
7. recommended is `Set-StrictMode -Version Latest` to enable additional error checking
|
||||||
|
8. for readibility use UpperCamelCase for variables and functions, lowerCamelCase for everything else
|
||||||
|
9. on error call write-error with keyword "ERROR:" (to support log parsers) and exit the error code (mostly 1)
|
||||||
|
10. on success exit with error code 0 (exit 0)
|
||||||
|
|
||||||
|
Your Question is not answered here?
|
||||||
|
-----------------------------------
|
||||||
|
Send your question to: markus [at] fleschutz [dot] de
|
||||||
BIN
Powershell/Misc/Remove_ps1_from_New_context_menu.reg
Normal file
BIN
Powershell/Misc/Remove_ps1_from_New_context_menu.reg
Normal file
Binary file not shown.
BIN
Powershell/Misc/powershell_black_icon_64x64.png
Normal file
BIN
Powershell/Misc/powershell_black_icon_64x64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
BIN
Powershell/Misc/powershell_icon_256x256.png
Normal file
BIN
Powershell/Misc/powershell_icon_256x256.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.3 KiB |
BIN
Powershell/Misc/powershell_icon_64x64.png
Normal file
BIN
Powershell/Misc/powershell_icon_64x64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
18
Powershell/Scripts/MD5.ps1
Normal file
18
Powershell/Scripts/MD5.ps1
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX MD5.ps1 [<file>]
|
||||||
|
.DESCRIPTION prints the MD5 checksum of the given file
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($File = "")
|
||||||
|
if ($File -eq "" ) { $File = read-host "Enter path to file" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$Result = get-filehash $File -algorithm MD5
|
||||||
|
"MD5 hash is" $Result.Hash
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
18
Powershell/Scripts/SHA1.ps1
Normal file
18
Powershell/Scripts/SHA1.ps1
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX SHA1.ps1 [<file>]
|
||||||
|
.DESCRIPTION prints the SHA1 checksum of the given file
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($File = "")
|
||||||
|
if ($File -eq "" ) { $File = read-host "Enter the filename" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$Result = get-filehash $File -algorithm SHA1
|
||||||
|
write-output "SHA1 hash is" $Result.Hash
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
18
Powershell/Scripts/SHA256.ps1
Normal file
18
Powershell/Scripts/SHA256.ps1
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX SHA256.ps1 [<file>]
|
||||||
|
.DESCRIPTION prints the SHA256 checksum of the given file
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($File = "")
|
||||||
|
if ($File -eq "" ) { $File = read-host "Enter the filename" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$Result = get-filehash $File -algorithm SHA256
|
||||||
|
write-output "SHA256 hash is:" $Result.Hash
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
53
Powershell/Scripts/add-firewall-rules.ps1
Normal file
53
Powershell/Scripts/add-firewall-rules.ps1
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX add-firewall-rules.ps1 [<path-to-executables>]
|
||||||
|
.DESCRIPTION adds firewall rules for the given executables, administrator rights are required
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
#Requires -RunAsAdministrator
|
||||||
|
|
||||||
|
param([string]$PathToExecutables = "")
|
||||||
|
|
||||||
|
$command = '
|
||||||
|
$output = ''Firewall rules for path '' + $args[0]
|
||||||
|
write-output $output
|
||||||
|
for($i = 1; $i -lt $args.count; $i++){
|
||||||
|
$path = $args[0]
|
||||||
|
$path += ''\''
|
||||||
|
$path += $args[$i]
|
||||||
|
|
||||||
|
$null = $args[$i] -match ''[^\\]*\.exe$''
|
||||||
|
$name = $matches[0]
|
||||||
|
$output = ''Adding firewall rule for '' + $name
|
||||||
|
write-output $output
|
||||||
|
$null = New-NetFirewallRule -DisplayName $name -Direction Inbound -Program $path -Profile Domain, Private -Action Allow
|
||||||
|
}
|
||||||
|
write-host -foregroundColor green -noNewline ''Done - press any key to continue...'';
|
||||||
|
[void]$Host.UI.RawUI.ReadKey(''NoEcho,IncludeKeyDown'');
|
||||||
|
'
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($PathToExecutables -eq "" ) {
|
||||||
|
$PathToExecutables = read-host "Enter path to executables"
|
||||||
|
}
|
||||||
|
|
||||||
|
$PathToExecutables = Convert-Path -Path $PathToExecutables
|
||||||
|
|
||||||
|
$Apps = Get-ChildItem "$PathToExecutables\*.exe" -Name
|
||||||
|
|
||||||
|
if($Apps.count -eq 0){
|
||||||
|
write-warning "No executables found. No Firewall rules have been created."
|
||||||
|
Write-Host -NoNewhLine 'Press any key to continue...';
|
||||||
|
[void]$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
$arg = "PathToExecutables $Apps"
|
||||||
|
Start-Process powershell -Verb runAs -ArgumentList "-command & {$command} $arg"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
27
Powershell/Scripts/add-memo.ps1
Normal file
27
Powershell/Scripts/add-memo.ps1
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX add-memo.ps1 [<text>]
|
||||||
|
.DESCRIPTION adds the given memo text to $HOME/Memos.csv
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($Text = "")
|
||||||
|
if ($Text -eq "" ) { $Text = read-host "Enter the memo text to add" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$Path = "$HOME/Memos.csv"
|
||||||
|
$Time = get-date -format "yyyy-MM-ddTHH:mm:ssZ" -asUTC
|
||||||
|
$User = $(whoami)
|
||||||
|
$Line = "$Time,$User,$Text"
|
||||||
|
|
||||||
|
if (-not(test-path "$Path" -pathType leaf)) {
|
||||||
|
write-output "Time,User,Text" > "$Path"
|
||||||
|
}
|
||||||
|
write-output $Line >> "$Path"
|
||||||
|
|
||||||
|
"✔️ added to 📄$Path"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
23
Powershell/Scripts/alert.ps1
Normal file
23
Powershell/Scripts/alert.ps1
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX alert.ps1 [<message>]
|
||||||
|
.DESCRIPTION handle and escalate the given alert message
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($Message = "")
|
||||||
|
|
||||||
|
if ($Message -eq "" ) {
|
||||||
|
$URL = read-host "Enter alert message"
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
echo "ALERT: $Message"
|
||||||
|
|
||||||
|
curl --header "Access-Token: o.PZl5XCp6SBl4F5PpaNXGDfFpUJZKAlEb" --header "Content-Type: application/json" --data-binary '{"type": "note", "title": "ALERT", "body": "$Message"}' --request POST https://api.pushbullet.com/v2/pushes
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
12
Powershell/Scripts/calibre-server.sh
Normal file
12
Powershell/Scripts/calibre-server.sh
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Syntax: ./calibre-server
|
||||||
|
# Description: starts a Calibre server
|
||||||
|
# Author: Markus Fleschutz
|
||||||
|
# Source: github.com/fleschutz/PowerShell
|
||||||
|
# License: CC0
|
||||||
|
|
||||||
|
echo "Starting Calibre Server ..."
|
||||||
|
calibre-server --port 8099 --num-per-page 100 --userdb $HOME/CalibreUsers.sqlite --log $HOME/CalibreServer.log --daemonize $HOME/'Calibre Library'
|
||||||
|
echo "OK - Calibre Server started."
|
||||||
|
exit 0
|
||||||
15
Powershell/Scripts/cd-desktop.ps1
Normal file
15
Powershell/Scripts/cd-desktop.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-desktop.ps1
|
||||||
|
.DESCRIPTION go to the user's desktop folder
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$TargetDir = resolve-path "$HOME/Desktop"
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
15
Powershell/Scripts/cd-docs.ps1
Normal file
15
Powershell/Scripts/cd-docs.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-docs.ps1
|
||||||
|
.DESCRIPTION go to the user's documents folder
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$TargetDir = resolve-path "$HOME/Documents"
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
15
Powershell/Scripts/cd-downloads.ps1
Normal file
15
Powershell/Scripts/cd-downloads.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-downloads.ps1
|
||||||
|
.DESCRIPTION go to the user's downloads folder
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$TargetDir = resolve-path "$HOME/Downloads"
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
15
Powershell/Scripts/cd-dropbox.ps1
Normal file
15
Powershell/Scripts/cd-dropbox.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-dropbox.ps1
|
||||||
|
.DESCRIPTION go to the user's Dropbox folder
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$TargetDir = resolve-path "$HOME/Dropbox"
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
15
Powershell/Scripts/cd-home.ps1
Normal file
15
Powershell/Scripts/cd-home.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-home.ps1
|
||||||
|
.DESCRIPTION go to the user's home folder
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$TargetDir = resolve-path "$HOME"
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
15
Powershell/Scripts/cd-music.ps1
Normal file
15
Powershell/Scripts/cd-music.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-music.ps1
|
||||||
|
.DESCRIPTION go to the user's music folder
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$TargetDir = resolve-path "$HOME/Music"
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
15
Powershell/Scripts/cd-onedrive.ps1
Normal file
15
Powershell/Scripts/cd-onedrive.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-onedrive.ps1
|
||||||
|
.DESCRIPTION go to the user's OneDrive folder
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$TargetDir = resolve-path "$HOME/OneDrive"
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
15
Powershell/Scripts/cd-pics.ps1
Normal file
15
Powershell/Scripts/cd-pics.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-pics.ps1
|
||||||
|
.DESCRIPTION go to the user's pictures folder
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$TargetDir = resolve-path "$HOME/Pictures"
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
21
Powershell/Scripts/cd-recycle-bin.ps1
Normal file
21
Powershell/Scripts/cd-recycle-bin.ps1
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-recycle-bin.ps1
|
||||||
|
.DESCRIPTION go to the user's recycle bin folder
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
function Get-CurrentUserSID { [CmdletBinding()] param()
|
||||||
|
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
|
||||||
|
return ([System.DirectoryServices.AccountManagement.UserPrincipal]::Current).SID.Value
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$TargetDir = 'C:\$Recycle.Bin\' + "$(Get-CurrentUserSID)"
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
15
Powershell/Scripts/cd-repos.ps1
Normal file
15
Powershell/Scripts/cd-repos.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-repos.ps1
|
||||||
|
.DESCRIPTION go to the user's Git repositories folder
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$TargetDir = resolve-path "$HOME/Repos"
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
19
Powershell/Scripts/cd-root.ps1
Normal file
19
Powershell/Scripts/cd-root.ps1
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-root.ps1
|
||||||
|
.DESCRIPTION go to the root directory (C: on Windows)
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
if ($IsLinux) {
|
||||||
|
$TargetDir = resolve-path "/"
|
||||||
|
} else {
|
||||||
|
$TargetDir = resolve-path "C:/"
|
||||||
|
}
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
15
Powershell/Scripts/cd-scripts.ps1
Normal file
15
Powershell/Scripts/cd-scripts.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-scripts.ps1
|
||||||
|
.DESCRIPTION go to the PowerShell Scripts folder
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$TargetDir = resolve-path "$PSScriptRoot"
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
15
Powershell/Scripts/cd-up.ps1
Normal file
15
Powershell/Scripts/cd-up.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-up.ps1
|
||||||
|
.DESCRIPTION go one directory level up
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$TargetDir = resolve-path ".."
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
15
Powershell/Scripts/cd-up2.ps1
Normal file
15
Powershell/Scripts/cd-up2.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-up2.ps1
|
||||||
|
.DESCRIPTION go two directory levels up
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$TargetDir = resolve-path "../.."
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
15
Powershell/Scripts/cd-up3.ps1
Normal file
15
Powershell/Scripts/cd-up3.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-up3.ps1
|
||||||
|
.DESCRIPTION go three directory levels up
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$TargetDir = resolve-path "../../.."
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
15
Powershell/Scripts/cd-up4.ps1
Normal file
15
Powershell/Scripts/cd-up4.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-up4.ps1
|
||||||
|
.DESCRIPTION go four directory levels up
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$TargetDir = resolve-path "../../../.."
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
15
Powershell/Scripts/cd-videos.ps1
Normal file
15
Powershell/Scripts/cd-videos.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cd-videos.ps1
|
||||||
|
.DESCRIPTION go to the user's videos folder
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$TargetDir = resolve-path "$HOME/Videos"
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||||
|
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂$TargetDir"
|
||||||
|
exit 0
|
||||||
35
Powershell/Scripts/check-cpu-temp.ps1
Normal file
35
Powershell/Scripts/check-cpu-temp.ps1
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX check-cpu-temp.ps1
|
||||||
|
.DESCRIPTION checks the CPU temperature
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (test-path "/sys/class/thermal/thermal_zone0/temp" -pathType leaf) {
|
||||||
|
[int]$IntTemp = get-content "/sys/class/thermal/thermal_zone0/temp"
|
||||||
|
$Temp = [math]::round($IntTemp / 1000.0, 1)
|
||||||
|
} else {
|
||||||
|
$data = Get-WMIObject -Query "SELECT * FROM Win32_PerfFormattedData_Counters_ThermalZoneInformation" -Namespace "root/CIMV2"
|
||||||
|
$Temp = @($data)[0].HighPrecisionTemperature
|
||||||
|
$Temp = [math]::round($Temp / 100.0, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Temp -gt "80") {
|
||||||
|
write-error "⚠️ $Temp °C CPU temperature is too high!"
|
||||||
|
exit 1
|
||||||
|
} elseif ($Temp -lt "-20") {
|
||||||
|
write-error "⚠️ $Temp °C CPU temperature is too low!"
|
||||||
|
exit 1
|
||||||
|
} elseif ($Temp -gt "50") {
|
||||||
|
"✔️ $Temp °C CPU temperature - quite high"
|
||||||
|
} elseif ($Temp -lt "0") {
|
||||||
|
"✔️ $Temp °C CPU temperature - quite low"
|
||||||
|
} else {
|
||||||
|
"✔️ $Temp °C CPU temperature - good"
|
||||||
|
}
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
32
Powershell/Scripts/check-dns-resolution.ps1
Normal file
32
Powershell/Scripts/check-dns-resolution.ps1
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX check-dns-resolution.ps1
|
||||||
|
.DESCRIPTION checks the DNS resolution with frequently used domain names
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
try {
|
||||||
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
write-progress "Reading Data/domain-names.csv..."
|
||||||
|
|
||||||
|
$PathToRepo = "$PSScriptRoot/.."
|
||||||
|
$Table = import-csv "$PathToRepo/Data/domain-names.csv"
|
||||||
|
|
||||||
|
foreach($Row in $Table) {
|
||||||
|
write-progress "Resolving $($Row.Domain) ..."
|
||||||
|
if ($IsLinux) {
|
||||||
|
$Ignore = nslookup $Row.Domain
|
||||||
|
} else {
|
||||||
|
$Ignore = resolve-dnsName $Row.Domain
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$Count = $Table.Length
|
||||||
|
|
||||||
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
|
$Average = [math]::round($Count / $Elapsed, 1)
|
||||||
|
"✔️ $Average domains/s ($Count domains resolved in $Elapsed sec)"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
27
Powershell/Scripts/check-drive-space.ps1
Normal file
27
Powershell/Scripts/check-drive-space.ps1
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX check-drive-space.ps1 [<drive>] [<min-level>]
|
||||||
|
.DESCRIPTION checks the given drive for free space left
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($Drive = "", [int]$MinLevel = 20) # minimum level in GB
|
||||||
|
|
||||||
|
if ($Drive -eq "" ) { $Drive = read-host "Enter drive to check" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$DriveDetails = (get-psdrive $Drive)
|
||||||
|
[int]$Free = (($DriveDetails.Free / 1024) / 1024) / 1024
|
||||||
|
[int]$Used = (($DriveDetails.Used / 1024) / 1024) / 1024
|
||||||
|
[int]$Total = ($Used + $Free)
|
||||||
|
|
||||||
|
if ($Free -lt $MinLevel) {
|
||||||
|
write-warning "Drive $Drive has only $Free GB left to use! ($Used GB out of $Total GB in use, minimum is $MinLevel GB)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
"✔️ $Free GB left on drive $Drive ($Used GB of $Total GB used)"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
25
Powershell/Scripts/check-file-system.ps1
Normal file
25
Powershell/Scripts/check-file-system.ps1
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX check-file-system.ps1 [<drive>]
|
||||||
|
.DESCRIPTION checks the validity of the file system (needs admin rights)
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
#Requires -RunAsAdministrator
|
||||||
|
|
||||||
|
param($Drive = "")
|
||||||
|
|
||||||
|
if ($Drive -eq "" ) {
|
||||||
|
$Drive = read-host "Enter drive (letter) to check"
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$Result = repair-volume -driveLetter $Drive -scan
|
||||||
|
if ($Result -ne "NoErrorsFound") { throw "'repair-volume' failed" }
|
||||||
|
|
||||||
|
write-host -foregroundColor green "✔️ file system on drive $Drive is clean"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
38
Powershell/Scripts/check-health.ps1
Normal file
38
Powershell/Scripts/check-health.ps1
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX check-health.ps1
|
||||||
|
.DESCRIPTION checks the health of the local computer
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
$Hostname = $(hostname)
|
||||||
|
$Healthy = 1
|
||||||
|
"Checking health of $Hostname ..."
|
||||||
|
|
||||||
|
& "$PSScriptRoot/check-swap-space.ps1"
|
||||||
|
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||||
|
|
||||||
|
if ($IsLinux) {
|
||||||
|
& "$PSScriptRoot/check-drive-space.ps1" /
|
||||||
|
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||||
|
} else {
|
||||||
|
& "$PSScriptRoot/check-drive-space.ps1" C
|
||||||
|
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||||
|
}
|
||||||
|
|
||||||
|
& "$PSScriptRoot/check-cpu-temp.ps1"
|
||||||
|
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||||
|
|
||||||
|
& "$PSScriptRoot/check-dns-resolution.ps1"
|
||||||
|
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||||
|
|
||||||
|
& "$PSScriptRoot/check-ping.ps1"
|
||||||
|
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||||
|
|
||||||
|
if ($Healthy) {
|
||||||
|
"✔️ $Hostname is healthy"
|
||||||
|
exit 0
|
||||||
|
} else {
|
||||||
|
write-warning "$Hostname is NOT healthy"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
33
Powershell/Scripts/check-ipv4-address.ps1
Normal file
33
Powershell/Scripts/check-ipv4-address.ps1
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX check-ipv4-address.ps1 [<address>]
|
||||||
|
.DESCRIPTION checks the given IPv4 address for validity
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($Address = "")
|
||||||
|
|
||||||
|
function IsIPv4AddressValid { param([string]$IP)
|
||||||
|
$RegEx = "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"
|
||||||
|
if ($IP -match $RegEx) {
|
||||||
|
return $true
|
||||||
|
} else {
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($Address -eq "" ) {
|
||||||
|
$Address = read-host "Enter IPv4 address to validate"
|
||||||
|
}
|
||||||
|
if (IsIPv4AddressValid $Address) {
|
||||||
|
write-host -foregroundColor green "OK - IPv4 address $Address is valid"
|
||||||
|
exit 0
|
||||||
|
} else {
|
||||||
|
write-warning "Invalid IPv4 address: $Address"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
46
Powershell/Scripts/check-ipv6-address.ps1
Normal file
46
Powershell/Scripts/check-ipv6-address.ps1
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX check-ipv6-address.ps1 [<address>]
|
||||||
|
.DESCRIPTION checks the given IPv6 address for validity
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($Address = "")
|
||||||
|
|
||||||
|
function IsIPv6AddressValid { param([string]$IP)
|
||||||
|
$IPv4Regex = '(((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2}))'
|
||||||
|
$G = '[a-f\d]{1,4}'
|
||||||
|
$Tail = @(":",
|
||||||
|
"(:($G)?|$IPv4Regex)",
|
||||||
|
":($IPv4Regex|$G(:$G)?|)",
|
||||||
|
"(:$IPv4Regex|:$G(:$IPv4Regex|(:$G){0,2})|:)",
|
||||||
|
"((:$G){0,2}(:$IPv4Regex|(:$G){1,2})|:)",
|
||||||
|
"((:$G){0,3}(:$IPv4Regex|(:$G){1,2})|:)",
|
||||||
|
"((:$G){0,4}(:$IPv4Regex|(:$G){1,2})|:)")
|
||||||
|
[string] $IPv6RegexString = $G
|
||||||
|
$Tail | foreach { $IPv6RegexString = "${G}:($IPv6RegexString|$_)" }
|
||||||
|
$IPv6RegexString = ":(:$G){0,5}((:$G){1,2}|:$IPv4Regex)|$IPv6RegexString"
|
||||||
|
$IPv6RegexString = $IPv6RegexString -replace '\(' , '(?:' # make all groups non-capturing
|
||||||
|
[regex] $IPv6Regex = $IPv6RegexString
|
||||||
|
if ($IP -imatch "^$IPv6Regex$") {
|
||||||
|
return $true
|
||||||
|
} else {
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($Address -eq "" ) {
|
||||||
|
$Address = read-host "Enter IPv6 address to validate"
|
||||||
|
}
|
||||||
|
if (IsIPv6AddressValid $Address) {
|
||||||
|
write-host -foregroundColor green "OK - IPv6 address $Address is valid"
|
||||||
|
exit 0
|
||||||
|
} else {
|
||||||
|
write-warning "Invalid IPv6 address: $Address"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
34
Powershell/Scripts/check-mac-address.ps1
Normal file
34
Powershell/Scripts/check-mac-address.ps1
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX check-mac-address.ps1 [<MAC>]
|
||||||
|
.DESCRIPTION checks the given MAC address for validity
|
||||||
|
MAC address like 00:00:00:00:00:00 or 00-00-00-00-00-00 or 000000000000
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($MAC = "")
|
||||||
|
|
||||||
|
function IsMACAddressValid { param([string]$mac)
|
||||||
|
$RegEx = "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})|([0-9A-Fa-f]{2}){6}$"
|
||||||
|
if ($mac -match $RegEx) {
|
||||||
|
return $true
|
||||||
|
} else {
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($MAC -eq "" ) {
|
||||||
|
$MAC = read-host "Enter MAC address to validate"
|
||||||
|
}
|
||||||
|
if (IsMACAddressValid $MAC) {
|
||||||
|
write-host -foregroundColor green "OK - MAC address $MAC is valid"
|
||||||
|
exit 0
|
||||||
|
} else {
|
||||||
|
write-warning "Invalid MAC address: $MAC"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
32
Powershell/Scripts/check-ping.ps1
Normal file
32
Powershell/Scripts/check-ping.ps1
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX check-ping.ps1
|
||||||
|
.DESCRIPTION checks the ping latency to the internet
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
try {
|
||||||
|
write-verbose "Sending pings to the internet ..."
|
||||||
|
$Pings = test-connection -count 1 -computerName heise.de,cnn.com,github.com,www.microsoft.com,dropbox.com,amazon.com,google.com,bing.com,youtube.com
|
||||||
|
|
||||||
|
[int]$Min = 9999999
|
||||||
|
[int]$Max = 0
|
||||||
|
[int]$Avg = 0
|
||||||
|
foreach($Ping in $Pings) {
|
||||||
|
if ($IsLinux) {
|
||||||
|
[int]$Latency = $Ping.latency
|
||||||
|
} else {
|
||||||
|
[int]$Latency = $Ping.ResponseTime
|
||||||
|
}
|
||||||
|
if ($Latency -lt $Min) { $Min = $Latency }
|
||||||
|
if ($Latency -gt $Max) { $Max = $Latency }
|
||||||
|
$Avg += $Latency
|
||||||
|
}
|
||||||
|
$Avg = $Avg / $Pings.count
|
||||||
|
|
||||||
|
"✔️ $Avg ms average ping latency ($Min ms min, $Max ms max)"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
38
Powershell/Scripts/check-swap-space.ps1
Normal file
38
Powershell/Scripts/check-swap-space.ps1
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX check-swap-space.ps1 [<min-level>]
|
||||||
|
.DESCRIPTION checks the free swap space
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param([int]$MinLevel = 50) # minimum level in GB
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($IsLinux) {
|
||||||
|
$Result = $(free --mega | grep Swap:)
|
||||||
|
[int]$Total = $Result.subString(5,14)
|
||||||
|
[int]$Used = $Result.substring(20,13)
|
||||||
|
[int]$Free = $Result.substring(31,12)
|
||||||
|
} else {
|
||||||
|
$Items = get-wmiobject -class "Win32_PageFileUsage" -namespace "root\CIMV2" -computername localhost
|
||||||
|
foreach ($Item in $Items) {
|
||||||
|
[int]$Total = $Item.AllocatedBaseSize
|
||||||
|
[int]$Used = $Item.CurrentUsage
|
||||||
|
[int]$Free = ($Total - $Used)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Total -eq "0") {
|
||||||
|
write-warning "No swap space configured!"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if ($Free -lt $MinLevel) {
|
||||||
|
write-warning "Swap space has only $Free GB left to use! ($Used GB out of $Total GB in use, minimum is $MinLevel GB)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
"✔️ $Free GB left on swap space ($Used GB of $Total GB used)"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
35
Powershell/Scripts/check-symlinks.ps1
Normal file
35
Powershell/Scripts/check-symlinks.ps1
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX check-symlinks.ps1 [<dir-tree>]
|
||||||
|
.DESCRIPTION checks every symlink in the given directory tree
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($DirTree = "")
|
||||||
|
|
||||||
|
if ($DirTree -eq "" ) {
|
||||||
|
$DirTree = read-host "Enter the path to the directory tree"
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
write-progress "Checking symlinks in $DirTree..."
|
||||||
|
[int]$SymlinksTotal = [int]$SymlinksBroken = 0
|
||||||
|
Get-ChildItem $DirTree -recurse | Where { $_.Attributes -match "ReparsePoint" } | ForEach-Object {
|
||||||
|
$Symlink = $_.FullName
|
||||||
|
$Target = ($_ | Select-Object -ExpandProperty Target -ErrorAction Ignore)
|
||||||
|
if ($Target) {
|
||||||
|
$path = $_.FullName + "\..\" + ($_ | Select-Object -ExpandProperty Target)
|
||||||
|
$item = Get-Item $path -ErrorAction Ignore
|
||||||
|
if (!$item) {
|
||||||
|
write-warning "Broken symlink: $Symlink -> $Target"
|
||||||
|
$SymlinksBroken++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$SymlinksTotal++
|
||||||
|
}
|
||||||
|
write-host -foregroundColor green "OK - found $SymlinksTotal symlinks total, $SymlinksBroken symlinks are broken"
|
||||||
|
exit $SymlinksBroken
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
51
Powershell/Scripts/check-weather.ps1
Normal file
51
Powershell/Scripts/check-weather.ps1
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX check-weather.ps1 [<location>]
|
||||||
|
.DESCRIPTION checks the weather for critical values
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($Location = "") # empty means determine automatically
|
||||||
|
|
||||||
|
function Check { param([int]$Value, [int]$NormalMin, [int]$NormalMax, [string]$Unit)
|
||||||
|
if ($Value -lt $NormalMin) {
|
||||||
|
return "$Value $Unit ! "
|
||||||
|
}
|
||||||
|
if ($Value -gt $NormalMax) {
|
||||||
|
return "$Value $Unit ! "
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$Weather = (Invoke-WebRequest http://wttr.in/${Location}?format=j1 -UserAgent "curl" ).Content | ConvertFrom-Json
|
||||||
|
|
||||||
|
$Temp = $Weather.current_condition.temp_C
|
||||||
|
$Precip = $Weather.current_condition.precipMM
|
||||||
|
$Humidity = $Weather.current_condition.humidity
|
||||||
|
$Pressure = $Weather.current_condition.pressure
|
||||||
|
$WindSpeed = $Weather.current_condition.windspeedKmph
|
||||||
|
$WindDir = $Weather.current_condition.winddir16Point
|
||||||
|
$UV = $Weather.current_condition.uvIndex
|
||||||
|
$Visib = $Weather.current_condition.visibility
|
||||||
|
$Clouds = $Weather.current_condition.cloudcover
|
||||||
|
$Desc = $Weather.current_condition.weatherDesc.value
|
||||||
|
$Area = $Weather.nearest_area.areaName.value
|
||||||
|
$Region = $Weather.nearest_area.region.value
|
||||||
|
"Now: $($Temp)°C $($Precip)mm $($Humidity)% $($WindSpeed)km/h from $WindDir $($Pressure)hPa UV$($UV) $($Visib)km $($Clouds)% $Desc at $Area ($Region)"
|
||||||
|
|
||||||
|
$Result+=Check $Weather.current_condition.windspeedKmph 0 48 "km/h"
|
||||||
|
$Result+=Check $Weather.current_condition.visibility 1 1000 "km visibility"
|
||||||
|
$Result+=Check $Weather.current_condition.temp_C -20 40 "°C"
|
||||||
|
$Result+=Check $Weather.current_condition.uvIndex 0 6 "UV"
|
||||||
|
|
||||||
|
if ($Result -eq "") {
|
||||||
|
"Calm weather"
|
||||||
|
} else {
|
||||||
|
"WEATHER ALERT: $Result"
|
||||||
|
}
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
19
Powershell/Scripts/check-windows-system-files.ps1
Normal file
19
Powershell/Scripts/check-windows-system-files.ps1
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX check-windows-system-files.ps1
|
||||||
|
.DESCRIPTION checks the validity of the Windows system files (requires admin rights)
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
#Requires -RunAsAdministrator
|
||||||
|
|
||||||
|
try {
|
||||||
|
sfc /verifyOnly
|
||||||
|
if ($lastExitCode -ne "0") { throw "'sfc /verifyOnly' failed" }
|
||||||
|
|
||||||
|
write-host -foregroundColor green "✔️ checked Windows system files"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
37
Powershell/Scripts/check-xml-file.ps1
Normal file
37
Powershell/Scripts/check-xml-file.ps1
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX check-xml-file [<file>]
|
||||||
|
.DESCRIPTION checks the given XML file for validity
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($File = "")
|
||||||
|
|
||||||
|
if ($File -eq "" ) {
|
||||||
|
$File = read-host "Enter path to XML file"
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$XmlFile = Get-Item $File
|
||||||
|
|
||||||
|
$script:ErrorCount = 0
|
||||||
|
|
||||||
|
# Perform the XSD Validation
|
||||||
|
$ReaderSettings = New-Object -TypeName System.Xml.XmlReaderSettings
|
||||||
|
$ReaderSettings.ValidationType = [System.Xml.ValidationType]::Schema
|
||||||
|
$ReaderSettings.ValidationFlags = [System.Xml.Schema.XmlSchemaValidationFlags]::ProcessInlineSchema -bor [System.Xml.Schema.XmlSchemaValidationFlags]::ProcessSchemaLocation
|
||||||
|
$ReaderSettings.add_ValidationEventHandler({ $script:ErrorCount++ })
|
||||||
|
$Reader = [System.Xml.XmlReader]::Create($XmlFile.FullName, $ReaderSettings)
|
||||||
|
while ($Reader.Read()) { }
|
||||||
|
$Reader.Close()
|
||||||
|
|
||||||
|
if ($script:ErrorCount -gt 0) {
|
||||||
|
write-warning "Invalid XML file"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
write-host -foregroundColor green "OK - XML file is valid"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
58
Powershell/Scripts/cherry-picker.ps1
Normal file
58
Powershell/Scripts/cherry-picker.ps1
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX cherry-picker.ps1 [<commit-id>] [<commit-message>] [<branches>] [<repo-dir>]
|
||||||
|
.DESCRIPTION cherry-picks a Git commit into multiple branches
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($CommitID = "", $CommitMessage = "", $Branches = "", $RepoDir = "$PWD")
|
||||||
|
|
||||||
|
if ($CommitID -eq "" ) { $CommitID = read-host "Enter the commit id to cherry-pick" }
|
||||||
|
if ($CommitMessage -eq "" ) { $CommitMessage = read-host "Enter the commit message to use" }
|
||||||
|
if ($Branches -eq "" ) { $Branches = read-host "Enter the target branches" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
|
set-location "$RepoDir"
|
||||||
|
|
||||||
|
foreach($Branch in $Branches) {
|
||||||
|
|
||||||
|
"STEP: Switching to branch $Branch (git checkout)..."
|
||||||
|
& git checkout --recurse-submodules --force $Branch
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git checkout' failed" }
|
||||||
|
|
||||||
|
"STEP: Updating submodules (git submodule update)..."
|
||||||
|
& git submodule update --init --recursive
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git submodule update' failed" }
|
||||||
|
|
||||||
|
"STEP: Cleaning the repository (git clean -fdx)..."
|
||||||
|
& git clean -fdx
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git clean -fdx' failed" }
|
||||||
|
|
||||||
|
& git submodule foreach --recursive git clean -fdx
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git clean -fdx' in submodules failed" }
|
||||||
|
|
||||||
|
"STEP: Pulling latest updates (git pull)..."
|
||||||
|
& git pull --recurse-submodules
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
|
||||||
|
|
||||||
|
"STEP: Checking the status (git status)..."
|
||||||
|
$Result = (git status)
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git status' failed" }
|
||||||
|
if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Branch is NOT clean: $Result" }
|
||||||
|
|
||||||
|
& git cherry-pick --no-commit "$CommitID"
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git cherry-pick $CommitID' failed" }
|
||||||
|
|
||||||
|
& git commit -m "$CommitMessage"
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git commit' failed" }
|
||||||
|
|
||||||
|
& git push
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git push' failed" }
|
||||||
|
}
|
||||||
|
"DONE."
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
33
Powershell/Scripts/clean-repo.ps1
Normal file
33
Powershell/Scripts/clean-repo.ps1
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX clean-repo.ps1 [<repo-dir>]
|
||||||
|
.DESCRIPTION cleans a Git repository from untracked files (including submodules, e.g. for a fresh build)
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($RepoDir = "$PWD")
|
||||||
|
|
||||||
|
try {
|
||||||
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
|
$RepoDirName = (get-item "$RepoDir").Name
|
||||||
|
|
||||||
|
"🧹 Cleaning Git repository 📂$RepoDirName from untracked files..."
|
||||||
|
|
||||||
|
$Null = (git --version)
|
||||||
|
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
|
& git -C "$RepoDir" clean -xfd -f # force + recurse into dirs + don't use the standard ignore rules
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' failed" }
|
||||||
|
|
||||||
|
& git -C "$RepoDir" submodule foreach --recursive git clean -xfd -f
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' in submodules failed" }
|
||||||
|
|
||||||
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
|
"✔️ cleaned Git repository 📂$RepoDirName in $Elapsed sec"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
43
Powershell/Scripts/clean-repos.ps1
Normal file
43
Powershell/Scripts/clean-repos.ps1
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX clean-repos.ps1 [<parent-dir>]
|
||||||
|
.DESCRIPTION cleans all Git repositories under the current/given directory from untracked files (including submodules)
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($ParentDir = "$PWD")
|
||||||
|
|
||||||
|
try {
|
||||||
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
|
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
|
||||||
|
|
||||||
|
$Null = (git --version)
|
||||||
|
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
|
$Folders = (get-childItem "$ParentDir" -attributes Directory)
|
||||||
|
$FolderCount = $Folders.Count
|
||||||
|
$ParentDirName = (get-item "$ParentDir").Name
|
||||||
|
"Found $FolderCount subfolders in 📂$ParentDirName, cleaning from untracked files..."
|
||||||
|
|
||||||
|
[int]$Step = 1
|
||||||
|
foreach ($Folder in $Folders) {
|
||||||
|
$FolderName = (get-item "$Folder").Name
|
||||||
|
"🧹 Cleaning 📂$FolderName ($Step/$FolderCount)..."
|
||||||
|
|
||||||
|
& git -C "$Folder" clean -xfd -f # force + recurse into dirs + don't use the standard ignore rules
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' failed" }
|
||||||
|
|
||||||
|
& git -C "$Folder" submodule foreach --recursive git clean -xfd -f
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' in submodules failed" }
|
||||||
|
|
||||||
|
$Step++
|
||||||
|
}
|
||||||
|
|
||||||
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
|
"✔️ cleaned $FolderCount Git repositories at 📂$ParentDirName in $Elapsed sec"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
15
Powershell/Scripts/clear-recycle-bin.ps1
Normal file
15
Powershell/Scripts/clear-recycle-bin.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX clear-recycle-bin.ps1
|
||||||
|
.DESCRIPTION removes the content of the recycle bin folder (can not be undo!)
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
try {
|
||||||
|
Clear-RecycleBin -Confirm:$false
|
||||||
|
"✔️ recycle bin have been emptied"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
49
Powershell/Scripts/clone-repos.ps1
Normal file
49
Powershell/Scripts/clone-repos.ps1
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX clone-repos.ps1 [<parent-dir>]
|
||||||
|
.DESCRIPTION clones well-known Git repositories under the current/given directory.
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($ParentDir = "$PWD")
|
||||||
|
|
||||||
|
try {
|
||||||
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
|
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
|
||||||
|
|
||||||
|
$Null = (git --version)
|
||||||
|
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
|
$Table = import-csv "$PSScriptRoot/../Data/git-repos.csv"
|
||||||
|
$TableCount = $Table.count
|
||||||
|
"Found $TableCount entries in Data/git-repos.csv database..."
|
||||||
|
|
||||||
|
[int]$Count = 0
|
||||||
|
foreach($Row in $Table) {
|
||||||
|
[string]$FolderName = $Row.FolderName
|
||||||
|
[string]$Branch = $Row.Branch
|
||||||
|
[string]$Shallow = $Row.Shallow
|
||||||
|
[string]$URL = $Row.URL
|
||||||
|
|
||||||
|
if (test-path "$ParentDir/$FolderName" -pathType container) {
|
||||||
|
"📂$FolderName exists, skipping..."
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if ($Shallow -eq "yes") {
|
||||||
|
"🢃 Cloning to 📂$FolderName, $Branch branch, shallow..."
|
||||||
|
& git clone --branch "$Branch" --depth 1 --shallow-submodules --recurse-submodules "$URL" "$ParentDir/$FolderName"
|
||||||
|
} else {
|
||||||
|
"🢃 Cloning to 📂$FolderName, $Branch branch, full history..."
|
||||||
|
& git clone --branch "$Branch" --recurse-submodules "$URL" "$ParentDir/$FolderName"
|
||||||
|
}
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git clone $URL' failed" }
|
||||||
|
$Count++
|
||||||
|
}
|
||||||
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
|
"✔️ cloned $Count Git repositories at 📂$ParentDir in $Elapsed sec"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
9
Powershell/Scripts/close-calculator.ps1
Normal file
9
Powershell/Scripts/close-calculator.ps1
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX close-calculator.ps1
|
||||||
|
.DESCRIPTION closes the calculator program gracefully
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
& "$PSScriptRoot/close-program.ps1" "Calculator" "Calculator" "calc"
|
||||||
|
exit 0
|
||||||
9
Powershell/Scripts/close-chrome.ps1
Normal file
9
Powershell/Scripts/close-chrome.ps1
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX close-chrome.ps1
|
||||||
|
.DESCRIPTION closes Google Chrome gracefully
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
& "$PSScriptRoot/close-program.ps1" "Google Chrome" "chrome" "chrome"
|
||||||
|
exit 0
|
||||||
9
Powershell/Scripts/close-cortana.ps1
Normal file
9
Powershell/Scripts/close-cortana.ps1
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX close-cortana.ps1
|
||||||
|
.DESCRIPTION closes Cortana gracefully
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
& "$PSScriptRoot/close-program.ps1" "Cortana" "Cortana" "Cortana"
|
||||||
|
exit 0
|
||||||
9
Powershell/Scripts/close-edge.ps1
Normal file
9
Powershell/Scripts/close-edge.ps1
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX close-edge.ps1
|
||||||
|
.DESCRIPTION closes Microsoft Edge gracefully
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
& "$PSScriptRoot/close-program.ps1" "Microsoft Edge" "msedge" "msedge"
|
||||||
|
exit 0
|
||||||
9
Powershell/Scripts/close-file-explorer.ps1
Normal file
9
Powershell/Scripts/close-file-explorer.ps1
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX close-file-explorer.ps1
|
||||||
|
.DESCRIPTION closes Microsoft File Explorer gracefully
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
& "$PSScriptRoot/close-program.ps1" "File Explorer" "explorer" "explorer"
|
||||||
|
exit 0
|
||||||
43
Powershell/Scripts/close-program.ps1
Normal file
43
Powershell/Scripts/close-program.ps1
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX close-program.ps1 [<full-program-name>] [<program-name>] [<program-alias-name>]
|
||||||
|
.DESCRIPTION closes the processes of the given program gracefully
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($FullProgramName = "", $ProgramName = "", $ProgramAliasName = "")
|
||||||
|
|
||||||
|
if ($ProgramName -eq "") {
|
||||||
|
get-process | where-object {$_.mainWindowTitle} | format-table Id, Name, mainWindowtitle -AutoSize
|
||||||
|
$ProgramName = read-host "Enter program name"
|
||||||
|
}
|
||||||
|
if ($FullProgramName -eq "") {
|
||||||
|
$FullProgramName = $ProgramName
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$Processes = get-process -name $ProgramName -errorAction 'silentlycontinue'
|
||||||
|
if ($Processes.Count -ne 0) {
|
||||||
|
foreach ($Process in $Processes) {
|
||||||
|
$Process.CloseMainWindow() | Out-Null
|
||||||
|
}
|
||||||
|
start-sleep -milliseconds 100
|
||||||
|
stop-process -name $ProgramName -force -errorAction 'silentlycontinue'
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$Processes = get-process -name $ProgramAliasName -errorAction 'silentlycontinue'
|
||||||
|
if ($Processes.Count -eq 0) {
|
||||||
|
throw "$FullProgramName is not started yet"
|
||||||
|
}
|
||||||
|
foreach ($Process in $Processes) {
|
||||||
|
$_.CloseMainWindow() | Out-Null
|
||||||
|
}
|
||||||
|
start-sleep -milliseconds 100
|
||||||
|
stop-process -name $ProgramName -force -errorAction 'silentlycontinue'
|
||||||
|
}
|
||||||
|
write-host -foregroundColor green "✔️ closed $FullProgramName, found ($($Processes.Count) process(es)"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
9
Powershell/Scripts/close-system-settings.ps1
Normal file
9
Powershell/Scripts/close-system-settings.ps1
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX close-system-settings.ps1
|
||||||
|
.DESCRIPTION closes the System Settings gracefully
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
& "$PSScriptRoot/close-program.ps1" "System Settings" "SystemSettings" "SystemSettings"
|
||||||
|
exit 0
|
||||||
9
Powershell/Scripts/close-thunderbird.ps1
Normal file
9
Powershell/Scripts/close-thunderbird.ps1
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX close-thunderbird.ps1
|
||||||
|
.DESCRIPTION closes Mozilla Thunderbird gracefully
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
& "$PSScriptRoot/close-program.ps1" "Mozilla Thunderbird" "thunderbird" "thunderbird"
|
||||||
|
exit 0
|
||||||
9
Powershell/Scripts/close-vlc.ps1
Normal file
9
Powershell/Scripts/close-vlc.ps1
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX close-vlc.ps1
|
||||||
|
.DESCRIPTION closes the VLC media player gracefully
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
& "$PSScriptRoot/close-program.ps1" "VLC media player" "vlc" "vlc"
|
||||||
|
exit 0
|
||||||
9
Powershell/Scripts/close-windows-terminal.ps1
Normal file
9
Powershell/Scripts/close-windows-terminal.ps1
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX close-windows-terminal.ps1
|
||||||
|
.DESCRIPTION closes Windows Terminal gracefully
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
& "$PSScriptRoot/close-program.ps1" "Windows Terminal" "WindowsTerminal" "WindowsTerminal"
|
||||||
|
exit 0
|
||||||
49
Powershell/Scripts/configure-git.ps1
Normal file
49
Powershell/Scripts/configure-git.ps1
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX configure-git.ps1 [<full-name>] [<email-address>] [<favorite-editor>]
|
||||||
|
.DESCRIPTION sets up the Git user configuration
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($FullName = "", $EmailAddress = "", $FavoriteEditor = "")
|
||||||
|
if ($FullName -eq "") { $FullName = read-host "Enter your full name" }
|
||||||
|
if ($EmailAddress -eq "") { $EmailAddress = read-host "Enter your e-mail address"}
|
||||||
|
if ($FavoriteEditor -eq "") { $FavoriteEditor = read-host "Enter your favorite text editor (emacs,nano,vi,vim,...)" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$Null = (git --version)
|
||||||
|
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
|
# Basic settings:
|
||||||
|
& git config --global user.name $FullName
|
||||||
|
& git config --global user.email $EmailAddress
|
||||||
|
& git config --global core.editor $FavoriteEditor
|
||||||
|
& git config --global http.sslVerify false
|
||||||
|
& git config --global core.autocrlf false
|
||||||
|
& git config --global core.symlinks true
|
||||||
|
& git config --global core.longpaths true
|
||||||
|
& git config --global init.defaultBranch main
|
||||||
|
& git config --global merge.renamelimit 99999
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git config' failed (in basic settings)" }
|
||||||
|
|
||||||
|
# Basic shortcuts:
|
||||||
|
& git config --global alias.co "checkout"
|
||||||
|
& git config --global alias.br "branch"
|
||||||
|
& git config --global alias.ci "commit"
|
||||||
|
& git config --global alias.st "status"
|
||||||
|
& git config --global alias.pl "pull --recurse-submodules"
|
||||||
|
& git config --global alias.ps "push"
|
||||||
|
& git config --global alias.mrg "merge --no-commit --no-ff"
|
||||||
|
& git config --global alias.chp "cherry-pick --no-commit"
|
||||||
|
& git config --global alias.ls "log -n20 --pretty=format:'%Cred%h%Creset%C(yellow)%d%Creset %s %C(bold blue)by %an%Creset %C(green)%cr%Creset' --abbrev-commit"
|
||||||
|
& git config --global alias.smu "submodule update --init"
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git config' failed (in basic shortcuts)" }
|
||||||
|
|
||||||
|
"✔️ saved your Git configuration, it's now:"
|
||||||
|
& git config --list
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git config --list' failed" }
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
21
Powershell/Scripts/convert-csv2txt.ps1
Normal file
21
Powershell/Scripts/convert-csv2txt.ps1
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX convert-csv2txt.ps1 [<csv-file>]
|
||||||
|
.DESCRIPTION converts the given CSV file into a text list
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($Path = "")
|
||||||
|
if ($Path -eq "" ) { $Path = read-host "Enter path to CSV file" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$Table = Import-CSV -path "$Path" -header A,B,C,D,E,F,G,H
|
||||||
|
|
||||||
|
foreach($Row in $Table) {
|
||||||
|
write-output "* $($Row.A) $($Row.B) $($Row.C) $($Row.D) $($Row.E) $($Row.F) $($Row.G) $($Row.H)"
|
||||||
|
}
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
24
Powershell/Scripts/convert-mysql2csv.ps1
Normal file
24
Powershell/Scripts/convert-mysql2csv.ps1
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX convert-mysql2csv.ps1 [<server>] [<database>] [<username>] [<password>] [<query>]
|
||||||
|
.DESCRIPTION convert the MySQL database table to a CSV file
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
|
||||||
|
param($server = "", $database = "", $username = "", $password = "", $query = "")
|
||||||
|
if ($server -eq "") { $server = read-host "Enter the hostname/IP address of the MySQL server" }
|
||||||
|
if ($database -eq "") { $database = read-host "Enter the database name" }
|
||||||
|
if ($username -eq "") { $username = read-host "Enter the database username" }
|
||||||
|
if ($password -eq "") { $password = read-host "Enter the database user password" }
|
||||||
|
if ($query -eq "") { $query = read-host "Enter the database query" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$csvfilepath = "$PSScriptRoot\mysql_table.csv"
|
||||||
|
$result = Invoke-MySqlQuery -ConnectionString "server=$server; database=$database; user=$username; password=$password; pooling = false; convert zero datetime=True" -Sql $query -CommandTimeout 10000
|
||||||
|
$result | Export-Csv $csvfilepath -NoTypeInformation
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
38
Powershell/Scripts/convert-ps2bat.ps1
Normal file
38
Powershell/Scripts/convert-ps2bat.ps1
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX convert-ps2bat.ps1 [<pattern>]
|
||||||
|
.DESCRIPTION converts PowerShell script(s) to .bat files
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($Pattern = "")
|
||||||
|
if ($Pattern -eq "") { $Pattern = read-host "Enter path to the PowerShell script(s)" }
|
||||||
|
|
||||||
|
function Convert-PowerShellToBatch
|
||||||
|
{
|
||||||
|
param
|
||||||
|
(
|
||||||
|
[Parameter(Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName)]
|
||||||
|
[string]
|
||||||
|
[Alias("FullName")]
|
||||||
|
$Path
|
||||||
|
)
|
||||||
|
|
||||||
|
process
|
||||||
|
{
|
||||||
|
$encoded = [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes((Get-Content -Path $Path -Raw -Encoding UTF8)))
|
||||||
|
$newPath = [Io.Path]::ChangeExtension($Path, ".bat")
|
||||||
|
"@echo off`npowershell.exe -NoExit -encodedCommand $encoded" | Set-Content -Path $newPath -Encoding Ascii
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$Files = get-childItem -path "$Pattern"
|
||||||
|
foreach ($File in $Files) {
|
||||||
|
Convert-PowerShellToBatch "$File"
|
||||||
|
}
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
25
Powershell/Scripts/convert-sql2csv.ps1
Normal file
25
Powershell/Scripts/convert-sql2csv.ps1
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX convert-sql2csv.ps1 [<server>] [<database>] [<username>] [<password>] [<query>]
|
||||||
|
.DESCRIPTION convert the SQL database table to a CSV file
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($server = "", $database = "", $username = "", $password = "", $query = "")
|
||||||
|
if ($server -eq "") { $server = read-host "Enter the hostname/IP address of the SQL server" }
|
||||||
|
if ($database -eq "") { $database = read-host "Enter the database name" }
|
||||||
|
if ($username -eq "") { $username = read-host "Enter the database username" }
|
||||||
|
if ($password -eq "") { $password = read-host "Enter the database user password" }
|
||||||
|
if ($query -eq "") { $query = read-host "Enter the database query" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
|
||||||
|
$creds = New-Object System.Management.Automation.PSCredential ($username, $secpasswd)
|
||||||
|
$csvfilepath = "$PSScriptRoot\sqlserver_table.csv"
|
||||||
|
$result = Invoke-SqlServerQuery -Credential $creds -ConnectionTimeout 10000 -Database $database -Server $server -Sql $query -CommandTimeout 10000
|
||||||
|
$result | Export-Csv $csvfilepath -NoTypeInformation
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
22
Powershell/Scripts/convert-txt2wav.ps1
Normal file
22
Powershell/Scripts/convert-txt2wav.ps1
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX convert-txt2wav.ps1 [<text>] [<wav-file>]
|
||||||
|
.DESCRIPTION converts the given text to a .WAV audio file
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($Text = "", $WavFile = "")
|
||||||
|
if ($Text -eq "") { $Text = read-host "Enter text to speak" }
|
||||||
|
if ($WavFile -eq "") { $WavFile = read-host "Enter .WAV file to save to" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
Add-Type -AssemblyName System.Speech
|
||||||
|
$SpeechSynthesizer = New-Object System.Speech.Synthesis.SpeechSynthesizer
|
||||||
|
$SpeechSynthesizer.SetOutputToWaveFile($tWavFile)
|
||||||
|
$SpeechSynthesizer.Speak($Text)
|
||||||
|
$SpeechSynthesizer.Dispose()
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
41
Powershell/Scripts/create-branch.ps1
Normal file
41
Powershell/Scripts/create-branch.ps1
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX create-branch.ps1 [<new-branch-name>] [<repo-dir>]
|
||||||
|
.DESCRIPTION creates and switches to a new branch in a Git repository
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($NewBranchName = "", $RepoDir = "$PWD")
|
||||||
|
if ($NewBranchName -eq "") { $NewBranchName = read-host "Enter new branch name" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
|
set-location "$RepoDir"
|
||||||
|
|
||||||
|
$Null = (git --version)
|
||||||
|
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
|
$RepoDirName = (get-item "$RepoDir").Name
|
||||||
|
"🢃 Fetching updates for Git repository 📂$RepoDirName ..."
|
||||||
|
|
||||||
|
& git fetch --all --recurse-submodules --jobs=4
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
|
||||||
|
|
||||||
|
& git checkout -b "$NewBranchName"
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git checkout -b $NewBranchName' failed" }
|
||||||
|
|
||||||
|
& git push origin "$NewBranchName"
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git push origin $NewBranchName' failed" }
|
||||||
|
|
||||||
|
& git submodule update --init --recursive
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git submodule update' failed" }
|
||||||
|
|
||||||
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
|
"✔️ created new branch '$NewBranchName' in Git repository 📂$RepoDirName in $Elapsed sec"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
27
Powershell/Scripts/create-shortcut.ps1
Normal file
27
Powershell/Scripts/create-shortcut.ps1
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX create-shortcut.ps1 [<shortcut>] [<target>] [<description>]
|
||||||
|
.DESCRIPTION creates a new shortcut
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($Shortcut = "", $Target = "", $Description)
|
||||||
|
if ($Shortcut -eq "" ) { $Shortcut = read-host "Enter filename of shortcut" }
|
||||||
|
if ($Target -eq "" ) { $Target = read-host "Enter path to target" }
|
||||||
|
if ($Description -eq "" ) { $Description = read-host "Enter description" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sh = new-object -ComObject WScript.Shell
|
||||||
|
$shortcut = $sh.CreateShortcut("$Shortcut.lnk")
|
||||||
|
$shortcut.TargetPath = "$Target"
|
||||||
|
$shortcut.WindowStyle = "1"
|
||||||
|
$shortcut.IconLocation = "C:\Windows\System32\SHELL32.dll, 3"
|
||||||
|
$shortcut.Description = "$Description"
|
||||||
|
$shortcut.save()
|
||||||
|
|
||||||
|
write-host -foregroundColor green "✔️ shortcut $Shortcut created."
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
20
Powershell/Scripts/create-symlink.ps1
Normal file
20
Powershell/Scripts/create-symlink.ps1
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX create-symlink.ps1 [<symlink>] [<target>]
|
||||||
|
.DESCRIPTION creates a symbolic link
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($Symlink = "", $Target = "")
|
||||||
|
if ($Symlink -eq "" ) { $Symlink = read-host "Enter filename of symlink" }
|
||||||
|
if ($Target -eq "" ) { $Target = read-host "Enter path to target" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
new-item -path "$Symlink" -itemType SymbolicLink -Value "$Target"
|
||||||
|
|
||||||
|
write-host -foregroundColor green "✔️ symlink $Symlink created (pointing to $Target)"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
36
Powershell/Scripts/create-tag.ps1
Normal file
36
Powershell/Scripts/create-tag.ps1
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX create-tag.ps1 [<new-tag-name>] [<repo-dir>]
|
||||||
|
.DESCRIPTION creates a new tag in the current/given Git repository
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($NewTagName = "", $RepoDir = "$PWD")
|
||||||
|
if ($NewTagName -eq "") { $NewTagName = read-host "Enter new tag name" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
|
set-location "$RepoDir"
|
||||||
|
|
||||||
|
$Null = (git --version)
|
||||||
|
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
|
$Result = (git status)
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git status' failed in $RepoDir" }
|
||||||
|
if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Repository is NOT clean: $Result" }
|
||||||
|
|
||||||
|
& "$PSScriptRoot/fetch-repo.ps1"
|
||||||
|
if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" }
|
||||||
|
|
||||||
|
& git tag "$NewTagName"
|
||||||
|
if ($lastExitCode -ne "0") { throw "Error: 'git tag $NewTagName' failed!" }
|
||||||
|
|
||||||
|
& git push origin "$NewTagName"
|
||||||
|
if ($lastExitCode -ne "0") { throw "Error: 'git push origin $NewTagName' failed!" }
|
||||||
|
|
||||||
|
"🔖 tag $NewTagName has been created"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
18
Powershell/Scripts/daily-tasks.sh
Normal file
18
Powershell/Scripts/daily-tasks.sh
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Syntax: ./daily-tasks.sh
|
||||||
|
# Description: execute PowerShell scripts automatically as daily tasks (Linux only)
|
||||||
|
# copy this script to /etc/cron.daily and adapt it
|
||||||
|
# Author: Markus Fleschutz
|
||||||
|
# License: CC0
|
||||||
|
|
||||||
|
HOMEDIR=/home/mf
|
||||||
|
# adapt this to your home directory
|
||||||
|
|
||||||
|
$HOMEDIR/PowerShell/Scripts/query-smart-data.ps1 $HOMEDIR
|
||||||
|
# to query S.M.A.R.T. data of all your HDD's/SSD's
|
||||||
|
|
||||||
|
$HOMEDIR/PowerShell/Scripts/check-dns-resolution.ps1
|
||||||
|
# to train the DNS cache with frequently used domain names
|
||||||
|
|
||||||
|
exit 0
|
||||||
168
Powershell/Scripts/decrypt-file.ps1
Normal file
168
Powershell/Scripts/decrypt-file.ps1
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX decrypt-file.ps1 [<path>] [<password>]
|
||||||
|
.DESCRIPTION decrypts the given file
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param([string]$Path = "", [string]$Password = "")
|
||||||
|
|
||||||
|
|
||||||
|
function DecryptFile {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Decrypts a file encrypted with Protect-File.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Decrypts a file using a provided cryptography key.
|
||||||
|
|
||||||
|
.PARAMETER FileName
|
||||||
|
File(s) to be decrypted.
|
||||||
|
|
||||||
|
.PARAMETER Key
|
||||||
|
Cryptography key as a SecureString be used for decryption.
|
||||||
|
|
||||||
|
.PARAMETER KeyAsPlainText
|
||||||
|
Cryptography key as a String to be used for decryption.
|
||||||
|
|
||||||
|
.PARAMETER CipherMode
|
||||||
|
Specifies the block cipher mode that was used for encryption.
|
||||||
|
|
||||||
|
.PARAMETER PaddingMode
|
||||||
|
Specifies the type of padding that was applied when the message data block was shorter than the full number of bytes needed for a cryptographic operation.
|
||||||
|
|
||||||
|
.PARAMETER Suffix
|
||||||
|
Suffix of the encrypted file to be removed.
|
||||||
|
|
||||||
|
.PARAMETER RemoveSource
|
||||||
|
Removes the source (encrypted) file after decrypting.
|
||||||
|
|
||||||
|
.OUTPUTS
|
||||||
|
System.IO.FileInfo. Unprotect-File will return FileInfo with the SourceFile as an added NoteProperty
|
||||||
|
#>
|
||||||
|
[CmdletBinding(DefaultParameterSetName='SecureString')]
|
||||||
|
[OutputType([System.IO.FileInfo[]])]
|
||||||
|
Param(
|
||||||
|
[Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
|
||||||
|
[Alias('PSPath','LiteralPath')]
|
||||||
|
[string[]]$FileName,
|
||||||
|
[Parameter(Mandatory=$false, Position=2, ValueFromPipelineByPropertyName=$true)]
|
||||||
|
[ValidateSet('AES','DES','RC2','Rijndael','TripleDES')]
|
||||||
|
[String]$Algorithm = 'AES',
|
||||||
|
[Parameter(Mandatory=$true, Position=3, ValueFromPipelineByPropertyName=$true, ParameterSetName='SecureString')]
|
||||||
|
[System.Security.SecureString]$Key,
|
||||||
|
[Parameter(Mandatory=$true, Position=3, ParameterSetName='PlainText')]
|
||||||
|
[String]$KeyAsPlainText,
|
||||||
|
[Parameter(Mandatory=$false, Position=4, ValueFromPipelineByPropertyName=$true)]
|
||||||
|
[System.Security.Cryptography.CipherMode]$CipherMode = 'CBC',
|
||||||
|
[Parameter(Mandatory=$false, Position=5, ValueFromPipelineByPropertyName=$true)]
|
||||||
|
[System.Security.Cryptography.PaddingMode]$PaddingMode = 'PKCS7',
|
||||||
|
[Parameter(Mandatory=$false, Position=6)]
|
||||||
|
[String]$Suffix,
|
||||||
|
[Parameter()]
|
||||||
|
[Switch]$RemoveSource
|
||||||
|
)
|
||||||
|
Process
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if($PSCmdlet.ParameterSetName -eq 'PlainText')
|
||||||
|
{
|
||||||
|
$Key = $KeyAsPlainText | ConvertTo-SecureString -AsPlainText -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Key)
|
||||||
|
$EncryptionKey = [System.Convert]::FromBase64String([System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR))
|
||||||
|
|
||||||
|
$Crypto = [System.Security.Cryptography.SymmetricAlgorithm]::Create($Algorithm)
|
||||||
|
$Crypto.Mode = $CipherMode
|
||||||
|
$Crypto.Padding = $PaddingMode
|
||||||
|
$Crypto.KeySize = $EncryptionKey.Length*8
|
||||||
|
$Crypto.Key = $EncryptionKey
|
||||||
|
}
|
||||||
|
Catch
|
||||||
|
{
|
||||||
|
Write-Error $_ -ErrorAction Stop
|
||||||
|
}
|
||||||
|
|
||||||
|
if(-not $PSBoundParameters.ContainsKey('Suffix'))
|
||||||
|
{
|
||||||
|
$Suffix = ".$Algorithm"
|
||||||
|
}
|
||||||
|
|
||||||
|
$Files = Get-Item -LiteralPath $FileName
|
||||||
|
|
||||||
|
ForEach($File in $Files)
|
||||||
|
{
|
||||||
|
If(-not $File.Name.EndsWith($Suffix))
|
||||||
|
{
|
||||||
|
Write-Error "$($File.FullName) does not have an extension of '$Suffix'."
|
||||||
|
Continue
|
||||||
|
}
|
||||||
|
|
||||||
|
$DestinationFile = $File.FullName -replace "$Suffix$"
|
||||||
|
|
||||||
|
Try
|
||||||
|
{
|
||||||
|
$FileStreamReader = New-Object System.IO.FileStream($File.FullName, [System.IO.FileMode]::Open)
|
||||||
|
$FileStreamWriter = New-Object System.IO.FileStream($DestinationFile, [System.IO.FileMode]::Create)
|
||||||
|
|
||||||
|
[Byte[]]$LenIV = New-Object Byte[] 4
|
||||||
|
$FileStreamReader.Seek(0, [System.IO.SeekOrigin]::Begin) | Out-Null
|
||||||
|
$FileStreamReader.Read($LenIV, 0, 3) | Out-Null
|
||||||
|
[Int]$LIV = [System.BitConverter]::ToInt32($LenIV, 0)
|
||||||
|
[Byte[]]$IV = New-Object Byte[] $LIV
|
||||||
|
$FileStreamReader.Seek(4, [System.IO.SeekOrigin]::Begin) | Out-Null
|
||||||
|
$FileStreamReader.Read($IV, 0, $LIV) | Out-Null
|
||||||
|
$Crypto.IV = $IV
|
||||||
|
|
||||||
|
$Transform = $Crypto.CreateDecryptor()
|
||||||
|
$CryptoStream = New-Object System.Security.Cryptography.CryptoStream($FileStreamWriter, $Transform, [System.Security.Cryptography.CryptoStreamMode]::Write)
|
||||||
|
$FileStreamReader.CopyTo($CryptoStream)
|
||||||
|
|
||||||
|
$CryptoStream.FlushFinalBlock()
|
||||||
|
$CryptoStream.Close()
|
||||||
|
$FileStreamReader.Close()
|
||||||
|
$FileStreamWriter.Close()
|
||||||
|
|
||||||
|
if($RemoveSource){Remove-Item $File.FullName}
|
||||||
|
|
||||||
|
Get-Item $DestinationFile | Add-Member –MemberType NoteProperty –Name SourceFile –Value $File.FullName -PassThru
|
||||||
|
}
|
||||||
|
Catch
|
||||||
|
{
|
||||||
|
Write-Error $_
|
||||||
|
If($FileStreamWriter)
|
||||||
|
{
|
||||||
|
$FileStreamWriter.Close()
|
||||||
|
Remove-Item -LiteralPath $DestinationFile -Force
|
||||||
|
}
|
||||||
|
Continue
|
||||||
|
}
|
||||||
|
Finally
|
||||||
|
{
|
||||||
|
if($CryptoStream){$CryptoStream.Close()}
|
||||||
|
if($FileStreamReader){$FileStreamReader.Close()}
|
||||||
|
if($FileStreamWriter){$FileStreamWriter.Close()}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($Path -eq "" ) {
|
||||||
|
$Path = read-host "Enter path to file"
|
||||||
|
}
|
||||||
|
if ($Password -eq "" ) {
|
||||||
|
$Password = read-host "Enter password"
|
||||||
|
}
|
||||||
|
|
||||||
|
$PasswordBase64 = [System.Convert]::ToBase64String($Password)
|
||||||
|
DecryptFile "$Path" -algorithm AES -keyAsPlainText $PasswordBase64 -removeSource
|
||||||
|
write-host -foregroundColor green "Done."
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
23
Powershell/Scripts/display-time.ps1
Normal file
23
Powershell/Scripts/display-time.ps1
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX display-time.ps1 [<seconds>]
|
||||||
|
.DESCRIPTION displays the current time for 10 seconds by default
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param([int]$Seconds = 10)
|
||||||
|
|
||||||
|
try {
|
||||||
|
for ([int]$i = 0; $i -lt $Seconds; $i++) {
|
||||||
|
clear-host
|
||||||
|
write-output ""
|
||||||
|
$CurrentTime = Get-Date -format "yyyy-MM-dd HH:mm:ss"
|
||||||
|
./write-big $CurrentTime
|
||||||
|
write-output ""
|
||||||
|
start-sleep -s 1
|
||||||
|
}
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
23
Powershell/Scripts/download-dir.ps1
Normal file
23
Powershell/Scripts/download-dir.ps1
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX download-dir.ps1 [<URL>]
|
||||||
|
.DESCRIPTION downloads a directory tree from the given URL
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($URL = "")
|
||||||
|
if ($URL -eq "") { $URL = read-host "Enter directory URL to download" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
& wget --version
|
||||||
|
if ($lastExitCode -ne "0") { throw "Can't execute 'wget' - make sure wget is installed and available" }
|
||||||
|
|
||||||
|
& wget --mirror --convert-links --adjust-extension --page-requisites --no-parent $URL --directory-prefix . --no-verbose
|
||||||
|
if ($lastExitCode -ne "0") { throw "Can't execute 'wget --mirror $URL'" }
|
||||||
|
|
||||||
|
write-host -foregroundColor green "OK - directory downloaded from $URL"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
23
Powershell/Scripts/download-file.ps1
Normal file
23
Powershell/Scripts/download-file.ps1
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX download-file.ps1 [<URL>]
|
||||||
|
.DESCRIPTION downloads a file from the given URL
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($URL = "")
|
||||||
|
if ($URL -eq "") { $URL = read-host "Enter file URL to download" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
& wget --version
|
||||||
|
if ($lastExitCode -ne "0") { throw "Can't execute 'wget' - make sure wget is installed and available" }
|
||||||
|
|
||||||
|
& wget --mirror --convert-links --adjust-extension --page-requisites --no-parent $URL --directory-prefix . --no-verbose
|
||||||
|
if ($lastExitCode -ne "0") { throw "Can't execute 'wget --mirror $URL'" }
|
||||||
|
|
||||||
|
write-host -foregroundColor green "OK - file downloaded from $URL"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
23
Powershell/Scripts/edit.ps1
Normal file
23
Powershell/Scripts/edit.ps1
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX edit.ps1 <filename>
|
||||||
|
.DESCRIPTION starts the built-in text editor to edit the given file
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($Filename = "")
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($IsLinux) {
|
||||||
|
& vi "$Filename"
|
||||||
|
if ($lastExitCode -ne "0") { throw "Can't execute 'vi' - make sure vi is installed and available" }
|
||||||
|
} else {
|
||||||
|
& notepad.exe "$Filename"
|
||||||
|
if ($lastExitCode -ne "0") { throw "Can't execute 'notepad.exe' - make sure notepad.exe is installed and available" }
|
||||||
|
}
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
291
Powershell/Scripts/enable-crash-dumps.ps1
Normal file
291
Powershell/Scripts/enable-crash-dumps.ps1
Normal file
@@ -0,0 +1,291 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX enable-crash-dumps.ps1
|
||||||
|
.DESCRIPTION enables the writing of crash dumps
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
# #
|
||||||
|
# Written by: Ryan Waters #
|
||||||
|
# #
|
||||||
|
# Program: Get-Dump.ps1 #
|
||||||
|
# Date: 2-06-2020 #
|
||||||
|
# Purpose: To set registry keys to gather a WER Usermode Dump #
|
||||||
|
# and be able to change from a custom, mini, or FULL #
|
||||||
|
# Dumps for ease of use for customers and others. #
|
||||||
|
# #
|
||||||
|
# EULA: Code is free to use for all, and free to distribute #
|
||||||
|
# I just ask that you leave the credit information and #
|
||||||
|
# this EULA and Comment Section in tact and do not delete. #
|
||||||
|
# #
|
||||||
|
# Bitwise Values: (For reference) #
|
||||||
|
# #
|
||||||
|
# 0x00000000 - MiniDumpNormal #
|
||||||
|
# 0x00000001 - MiniDumpWithDataSegs #
|
||||||
|
# 0x00000002 - MiniDumpWithFullMemory #
|
||||||
|
# 0x00000004 - MiniDumpWithHandleData #
|
||||||
|
# 0x00000008 - MiniDumpFilterMemory #
|
||||||
|
# 0x00000010 - MiniDumpScanMemory #
|
||||||
|
# 0x00000020 - MiniDumpWithUnloadedModules #
|
||||||
|
# 0x00000040 - MiniDumpWithIndirectlyReferenced #
|
||||||
|
# 0x00000080 - MemoryMiniDumpFilterModulePaths #
|
||||||
|
# 0x00000100 - MiniDumpWithProcessThreadData #
|
||||||
|
# 0x00000200 - MiniDumpWithPrivateReadWriteMemory #
|
||||||
|
# 0x00000400 - MiniDumpWithoutOptionalData #
|
||||||
|
# 0x00000800 - MiniDumpWithFullMemoryInfo #
|
||||||
|
# 0x00001000 - MiniDumpWithThreadInfo #
|
||||||
|
# 0x00002000 - MiniDumpWithCodeSegs #
|
||||||
|
# 0x00004000 - MiniDumpWithoutAuxiliaryState #
|
||||||
|
# 0x00008000 - MiniDumpWithFullAuxiliaryState #
|
||||||
|
# 0x00010000 - MiniDumpWithPrivateWriteCopyMemory #
|
||||||
|
# 0x00020000 - MiniDumpIgnoreInaccessibleMemory #
|
||||||
|
# 0x00040000 - MiniDumpWithTokenInformation #
|
||||||
|
# #
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
#Setting Values:
|
||||||
|
$MDN = '0'
|
||||||
|
$MDWDS = '1'
|
||||||
|
$MDWFM = '2'
|
||||||
|
$MDWHD = '4'
|
||||||
|
$MDFM = '8'
|
||||||
|
$MDSM = '10'
|
||||||
|
$MDWUM = '20'
|
||||||
|
$MDWIR = '40'
|
||||||
|
$MMDFMP = '80'
|
||||||
|
$MDWPTD = '100'
|
||||||
|
$MDWPRWM = '200'
|
||||||
|
$MDWOD = '400'
|
||||||
|
$MDWFMI = '800'
|
||||||
|
$MDWTI = '1000'
|
||||||
|
$MDWCS = '2000'
|
||||||
|
$MDWAS = '4000'
|
||||||
|
$MDWFAS = '8000'
|
||||||
|
$MDWPWCM = '10000'
|
||||||
|
$MDIIM = '20000'
|
||||||
|
$MDWTOI = '40000'
|
||||||
|
|
||||||
|
$a = $MDN
|
||||||
|
$b = $MDWDS
|
||||||
|
$c = $MDWFM
|
||||||
|
$d = $MDWHD
|
||||||
|
$e = $MDFM
|
||||||
|
$f = $MDSM
|
||||||
|
$g = $MDWUM
|
||||||
|
$h = $MDWIR
|
||||||
|
$i = $MMDFMP
|
||||||
|
$j = $MDWPTD
|
||||||
|
$k = $MDWPRWM
|
||||||
|
$l = $MDWOD
|
||||||
|
$m = $MDWFMI
|
||||||
|
$n = $MDWTI
|
||||||
|
$o = $MDWCS
|
||||||
|
$p = $MDWAS
|
||||||
|
$q = $MDWFAS
|
||||||
|
$r = $MDWPWCM
|
||||||
|
$s = $MDIIM
|
||||||
|
$t = $MDWTOI
|
||||||
|
|
||||||
|
$0x = "0x"
|
||||||
|
|
||||||
|
$array = @()
|
||||||
|
|
||||||
|
Clear-host
|
||||||
|
write-host "Setting up your machine to receive Usermode Dumps via WER."
|
||||||
|
Start-sleep -s 3
|
||||||
|
|
||||||
|
|
||||||
|
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpFolder" -Value "%LOCALAPPDATA%\CrashDumps" -PropertyType ExpandString -Force
|
||||||
|
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpCount" -Value "10" -PropertyType DWORD -Force
|
||||||
|
|
||||||
|
clear-host
|
||||||
|
write-host "What would you like to do?"
|
||||||
|
write-host "(0) Disable Dumps and restore system to factory."
|
||||||
|
write-host "(1) Enable System for Full Dumps."
|
||||||
|
write-host "(2) Enable System for Mini Dumps."
|
||||||
|
write-host "(3) Enable System for custom dump with options."
|
||||||
|
$NCD = Read-Host "Enter a number option"
|
||||||
|
|
||||||
|
If ($NCD -eq '3')
|
||||||
|
{
|
||||||
|
|
||||||
|
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpType" -Value "0" -PropertyType DWORD -Force
|
||||||
|
Do
|
||||||
|
{
|
||||||
|
clear-host
|
||||||
|
write-host "Here are the optional custom dump to add to your custom dump parameters:"
|
||||||
|
write-host "(1) Mini Dump Normal"
|
||||||
|
write-host "(2) Mini Dump With Data Segs"
|
||||||
|
write-host "(3) Mini Dump With Full Memory"
|
||||||
|
write-host "(4) Mini Dump With Handle Data"
|
||||||
|
write-host "(5) Mini Dump Filter Memory"
|
||||||
|
write-host "(6) Mini Dump Scan Memory"
|
||||||
|
write-host "(7) Mini Dump With Unloaded Modules"
|
||||||
|
write-host "(8) Mini Dump With Indirectly Referenced"
|
||||||
|
write-host "(9) Memory Mini Dump Filter Module Paths"
|
||||||
|
write-host "(10) Mini Dump With Process Thread Data"
|
||||||
|
write-host "(11) Mini Dump With Private Read Write Memory"
|
||||||
|
write-host "(12) Mini Dump Without Optional Data"
|
||||||
|
write-host "(13) Mini Dump With Full Memory Info"
|
||||||
|
write-host "(14) Mini Dump With Thread Info"
|
||||||
|
write-host "(15) Mini Dump With Code Segs"
|
||||||
|
write-host "(16) Mini Dump Without Auxiliary State"
|
||||||
|
write-host "(17) Mini Dump With Full Auxiliary State"
|
||||||
|
write-host "(18) Mini Dump With Private Write Copy Memory"
|
||||||
|
write-host "(19) Mini Dump Ignore Inaccessible Memory"
|
||||||
|
write-host "(20) Mini Dump With Token Information"
|
||||||
|
$Option = Read-Host "Enter one number value at a time and press enter. (Press 'q' when finished)"
|
||||||
|
if($Option -eq '1')
|
||||||
|
{
|
||||||
|
$array += [int]$a
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '2')
|
||||||
|
{
|
||||||
|
$array += [int]$b
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '3')
|
||||||
|
{
|
||||||
|
$array += [int]$c
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '4')
|
||||||
|
{
|
||||||
|
$array += [int]$d
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '5')
|
||||||
|
{
|
||||||
|
$array += [int]$e
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '6')
|
||||||
|
{
|
||||||
|
$array += [int]$f
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '7')
|
||||||
|
{
|
||||||
|
$array += [int]$g
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '8')
|
||||||
|
{
|
||||||
|
$array += [int]$h
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '9')
|
||||||
|
{
|
||||||
|
$array += [int]$i
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '10')
|
||||||
|
{
|
||||||
|
$array += [int]$j
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '11')
|
||||||
|
{
|
||||||
|
$array += [int]$k
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '12')
|
||||||
|
{
|
||||||
|
$array += [int]$l
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '13')
|
||||||
|
{
|
||||||
|
$array += [int]$m
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '14')
|
||||||
|
{
|
||||||
|
$array += [int]$n
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '15')
|
||||||
|
{
|
||||||
|
$array += [int]$o
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '16')
|
||||||
|
{
|
||||||
|
$array += [int]$p
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '17')
|
||||||
|
{
|
||||||
|
$array += [int]$q
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '18')
|
||||||
|
{
|
||||||
|
$array += [int]$r
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '19')
|
||||||
|
{
|
||||||
|
$array += [int]$s
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq '20')
|
||||||
|
{
|
||||||
|
$array += [int]$t
|
||||||
|
}
|
||||||
|
ElseIf($Option -eq 'q')
|
||||||
|
{
|
||||||
|
write-host "Closing application."
|
||||||
|
Start-Sleep -s 2
|
||||||
|
}
|
||||||
|
Else
|
||||||
|
{
|
||||||
|
write-host "Invalid Option, Try again."
|
||||||
|
Start-sleep -s 2
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
While($Option -ne "q")
|
||||||
|
$sum = $array -join '+'
|
||||||
|
$SumArray = Invoke-Expression $sum
|
||||||
|
$FinalSum = $0x + $SumArray
|
||||||
|
|
||||||
|
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "CustomDumpFlags" -Value "$FinalSum" -PropertyType DWORD -Force
|
||||||
|
|
||||||
|
write-host " "
|
||||||
|
write-host "Setting up the system for crash dumps requires a reboot"
|
||||||
|
}
|
||||||
|
ElseIf ($NCD -eq '0')
|
||||||
|
{
|
||||||
|
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpCount" -Force -ErrorAction SilentlyContinue
|
||||||
|
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpType" -Force -ErrorAction SilentlyContinue
|
||||||
|
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpFolder" -Force -ErrorAction SilentlyContinue
|
||||||
|
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "CustomDumpFlags" -Force -ErrorAction SilentlyContinue
|
||||||
|
write-host " "
|
||||||
|
$reboot = read-host "Registry reset to factory settings and cleared. It is recommended to restart your machine, would you like to now?"
|
||||||
|
if($reboot -eq "Yes" -or $reboot -eq "Y" -or $reboot -eq "yes" -or $reboot -eq "y")
|
||||||
|
{
|
||||||
|
shutdown -r
|
||||||
|
}
|
||||||
|
Else
|
||||||
|
{
|
||||||
|
write-host "Please restart the machine for settings to take effect at your convenience."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ElseIf ($NCD -eq '1')
|
||||||
|
{
|
||||||
|
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpType" -Value "2" -PropertyType DWORD -Force
|
||||||
|
write-host "The computer has been set up to create a Full Sized Dump and will be located in %LOCALAPPDATA%\CrashDumps."
|
||||||
|
write-host "The computer must also restart for settings to take effect. Would you like to now? (Y/n)"
|
||||||
|
if($reboot -eq "Yes" -or $reboot -eq "Y" -or $reboot -eq "yes" -or $reboot -eq "y")
|
||||||
|
{
|
||||||
|
shutdown -r
|
||||||
|
}
|
||||||
|
Else
|
||||||
|
{
|
||||||
|
write-host "Please restart the machine for settings to take effect at your convenience."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ElseIf ($NCD -eq '2')
|
||||||
|
{
|
||||||
|
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpType" -Value "1" -PropertyType DWORD -Force
|
||||||
|
write-host "The computer has been set up to create a Mini Dump and will be located in %LOCALAPPDATA%\CrashDumps."
|
||||||
|
write-host "The computer must also restart for settings to take effect. Would you like to now? (Y/n)"
|
||||||
|
if($reboot -eq "Yes" -or $reboot -eq "Y" -or $reboot -eq "yes" -or $reboot -eq "y")
|
||||||
|
{
|
||||||
|
shutdown -r
|
||||||
|
}
|
||||||
|
Else
|
||||||
|
{
|
||||||
|
write-host "Please restart the machine for settings to take effect at your convenience."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Else
|
||||||
|
{
|
||||||
|
write-host "You did not enter a valid option. Please re-run Get-Dump.ps1"
|
||||||
|
start-sleep -s 5
|
||||||
|
}
|
||||||
|
exit 0
|
||||||
21
Powershell/Scripts/enable-god-mode.ps1
Normal file
21
Powershell/Scripts/enable-god-mode.ps1
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<#
|
||||||
|
.SYNTAX enable-god-mode.ps1
|
||||||
|
.DESCRIPTION enables the god mode (adds a new icon to the desktop)
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
try {
|
||||||
|
$GodModeSplat = @{
|
||||||
|
Path = "$HOME\Desktop"
|
||||||
|
Name = "GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}"
|
||||||
|
ItemType = 'Directory'
|
||||||
|
}
|
||||||
|
$null = new-item @GodModeSplat
|
||||||
|
|
||||||
|
"✔️ new icon added to the desktop"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user