-
Notifications
You must be signed in to change notification settings - Fork 12
/
.aliasesrc
427 lines (348 loc) · 16.9 KB
/
.aliasesrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# ~/.aliasesrc
## ALIASES ##
## Crypto
alias base58tohex='base58 -d | xxd -p -c200'
alias wif2sha='base58 -d | xxd -p -c200 | sed s/^80// | rg -oz "[A-Fa-f0-9]{64}"'
## Compression/extraction.
### 7z
alias 7zcat="7z e -bd -so"
### Brotli
alias brcat="brotli -cd"
### Rar
alias rarcat="unrar p"
### Zip
alias zipcat="unzip -p"
### ZStandard (zstd).
alias tarzs-rm="tar -cv --remove-files --zstd -f"
alias tarzs="tar -cv --zstd -f"
alias zs="zstd -18 -T0"
alias zscat="zstdcat"
alias zsless="zstdless"
alias zsrm="zstd -18 --rm -T0"
## Convert and translate text
### AWK
#alias conv_rev_words="awk '{for(i=NF;i>0;--i)printf "%s%s",$i,(i>1?OFS:ORS)}'"
alias conv_rm_blanks="awk NF"
alias unicat='awk "!a[\$0]++{print}"'
### Buffer
alias buffer-1g="buffer -m 1024m -s 512k -t"
alias buffer-100m="buffer -m 100m -s 256k -t"
alias buffer-200m="buffer -m 200m -s 256k -t"
### Fold
#alias conv_folded="tee >(fold -sw10) >(fold -sw20) >(fold -sw30) >(fold -sw40) >(fold -sw60) >(fold -sw80) >/dev/null"
alias conv_folded=tee
alias conv_permutate="conv_to_spaces | conv_folded | conv-rm-trail-spaces \
| tee >(conv_rm_punct | conv-rm-trail-spaces | tee >(conv_to_asterisk) >(conv_to_at) >(conv_to_case_inv) >(conv_to_case_lower) >(conv_to_case_upper) >(conv_to_dashes) >(conv_to_pipes) >(conv_to_underscores) >(conv_to_alpha)) \
>(conv_to_case_lower) >(conv_to_case_lower | conv-to-case-uc-first) >(conv_to_case_lower | conv-to-case-uc-words) >(conv_to_case_upper) >(conv-to-case-uc-first) >(conv-to-case-uc-words) \
>(conv_to_commas) >(conv_to_print) >(conv_to_slashes) >(conv_to_stops) >(conv_to_tildes) \
| tee >(conv_rm_blank) \
| conv-rm-trail-spaces"
### Parallel
alias parallel-pipe="parallel -j 50% --block 1m --pipe --"
### Perl
alias filter-1of3='perl -e "while (<>) { print if $. % 3 == 0; }"' # Same as: split -n r/1/3
alias filter-2of3='perl -e "while (<>) { print if $. % 3 == 1; }"'
alias filter-3of3='perl -e "while (<>) { print if $. % 3 == 2; }"'
alias filter-1of4='perl -e "while (<>) { print if $. % 4 == 0; }"' # Same as: split -n r/1/4
alias filter-2of4='perl -e "while (<>) { print if $. % 4 == 1; }"'
alias filter-3of4='perl -e "while (<>) { print if $. % 4 == 2; }"'
alias filter-4of4='perl -e "while (<>) { print if $. % 4 == 3; }"'
alias filter-even='perl -e "while (<>) { print if $. % 2 == 0; }"' # Same as: split -n r/2/2
alias filter-odd='perl -e "while (<>) { print if $. % 2 == 1; }"' # Same as: split -n r/1/2
alias unicat2='perl -e '\''while(<>){if(!$s{$_}){print $_;$|=1;$s{$_}=1;}}'\'''
alias reverse="perl -nle 'print scalar reverse \$_'"
### Mixed
# Shell
alias for-each-file="find . -mindepth 1 -maxdepth 1 -type f -print0 | xargs -0 -L1"
### Sed
alias conv-rm-trail-spaces="sed -e 's/^[ \t]*//g' | sed -e 's/[ \t]*$//g'"
alias conv-to-case-uc-first="sed 's/./\u&/'"
alias conv-to-case-uc-words="sed 's/^./\U&/g; s/ ./\U&/g'"
alias swap-char-first-with-last="sed -E 's/(.)(.+)(.)/\3\2\1/'"
### Ripgrep
alias conv_rm_xml_lines="rg -v '[<>]'"
alias rg-all='rg -uuuz'
alias rg-all-pipe='tr -d "\0" | rg -uuu'
alias rg-accent-words='rg -o "\w{0,}[ąęáàâäãåćéèêëńíìîïóòôöõúùûüçñýÿźż]\w{0,}"'
alias rg-arabic='rg -oz "[\x{0621}-\x{0669}]+"' # Arabic
alias rg-armenian='rg -oz "[\x{0531}-\x{0587}]+"' # Armenian
alias rg-btc-addr='rg -Howz "[13][a-km-zA-HJ-NP-Z1-9]{25,34}|^(bc1|ltc1)[ac-hj-np-z02-9]{39,59}$|^(BC1|LTC1)[AC-HJ-NP-Z02-9]{39,59}"'
alias rg-chinese='rg -oz "[\x{4E00}-\x{9FFF}]+"' # Kanji
alias rg-greek='rg -oz "[\x{0374}-\x{03FF}]+"' # Greek
alias rg-hebrew='rg -oz "[\x{0590}-\x{05FE}]+"' # Hebrew
alias rg-japanese1='rg -oz "[\x{3040}-\x{309F}ー]+"' # Hiragana
alias rg-japanese2='rg -oz "[\x{30A0}-\x{30FF}ー]+"' # Katakana
alias rg-japanese='rg -oz "[\x{3040}-\x{30FF}ー]+"' # Hiragana & Katakana
alias rg-russian='rg -oz "[а-яёА-ЯЁ]+"' # Russian
alias rg-domain='rg -oz "([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}"'
alias rg-domain2urls='rg -o "([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}" -r "$(printf "\$0\nhttp://\$0\nhttps://\$0\nhttp://www.\$0\nhttps://www.\$0\n")"'
alias rg-email="rg -ow '[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+'"
alias rg-emoji='rg -oz "[\x{1F1FF}-\x{1F600}]+"'
alias rg-handle='rg -oz "@[a-zA-Z]\w{4,}"'
alias rg-hashtag='rg -oz "#[a-zA-Z]\w{4,}"'
alias rg-hex='rg -oz "[0-9a-fA-F]{2,}"'
alias rg-hindi='rg -oz "[\x{0905}-\x{097f}]+"'
alias rg-ip="rg -ow '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'"
alias rg-mailto='rg -oz "mailto:[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+"'
alias rg-number='rg -oz "[0-9]{2,}"'
alias rg-numbers-sep='rg -oz "\d+(,.\d+)+"'
alias rg-quoted="rg -ow -e '[\"]([^\"]+)\"' -e \"[']([^']+)'\" -r '\$1'"
alias rg-sha256='rg -owz "[A-Fa-f0-9]{64}"'
alias rg-text='rg -owz "\w+(\W\w+)+"'
alias rg-uuid='rg "[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}"'
alias rg-unicode='rg -oz "[\x{0100}-\x{FFFF}]+"'
alias rg-uri='rg -owz "[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)"'
alias rg-url='rg -owz "\w+://[^.]+.([-a-zA-Z0-9@:%_+.~#?&//=]*)"'
alias rg-var="rg -oz '\\\$[^(){}<>:; ]+'"
alias rg-wif='rg -owz "[59KLc][1-9A-HJ-NP-Za-km-z]{50,51}"'
alias rg-word2='rg -owz "\S{3,}"'
alias rg-word='rg -owz "\w{3,}"'
alias rg-words-sep='rg -owz "\w+(,.-\w+)+"'
alias rg-words='rg -owz "\w+(\s\w+)+"'
alias rg_1S="rg -o '\S+'"
alias rg_1w="rg -o '(\w{3,20})'"
alias rg_2S="rg -o '\S+\s+\S+'"
alias rg_2w="rg -o '(\w{3,20})\W(\w{3,20})'"
alias rg_2W='rg -o "(\w{3,20})\W(\w{3,20})" -r "\$1 \$2$(printf "\n\r")\$2 \$1" | tr -d "\r"'
alias rg_3S="rg -o '\S+\s+\S+\s+\S+'"
alias rg_3w="rg -o '(\w{3,20})\W(\w{3,20})\W(\w{3,20})'"
alias rg_3W='rg -o "(\w{3,20})\W(\w{3,20})\W(\w{3,20})" -r "\$1 \$2 \$3$(printf "\n\r")\$1 \$3 \$2$(printf "\n\r")\$2 \$1 \$3$(printf "\n\r")\$2 \$3 \$1$(printf "\n\r")\$3 \$1 \$2$(printf "\n\r")\$3 \$2 \$1" | tr -d "\r"'
alias rg_4S="rg -o '\S+\s+\S+\s+\S+\s+\S+'"
alias rg_4w="rg -o '(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})'"
alias rg_4W='rg -o "(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})" -r "\$1 \$2 \$3 \$4$(printf "\n\r")\$1 \$3 \$2 \$4$(printf "\n\r")\$2 \$1 \$3 \$4$(printf "\n\r")\$2 \$3 \$1 \$4$(printf "\n\r")\$3 \$1 \$2 \$4$(printf "\n\r")\$3 \$2 \$1 \$4$(printf "\n\r")\$1 \$2 \$4 \$3$(printf "\n\r")\$1 \$3 \$4 \$2$(printf "\n\r")\$2 \$1 \$4 \$3$(printf "\n\r")\$2 \$3 \$4 \$1$(printf "\n\r")\$3 \$1 \$4 \$2$(printf "\n\r")\$3 \$2 \$4 \$1$(printf "\n\r")\$1 \$4 \$2 \$3$(printf "\n\r")\$1 \$4 \$3 \$2$(printf "\n\r")\$2 \$4 \$1 \$3$(printf "\n\r")\$2 \$4 \$3 \$1$(printf "\n\r")\$3 \$4 \$1 \$2$(printf "\n\r")\$3 \$4 \$2 \$1$(printf "\n\r")\$4 \$1 \$2 \$3$(printf "\n\r")\$4 \$1 \$3 \$2$(printf "\n\r")\$4 \$2 \$1 \$3$(printf "\n\r")\$4 \$2 \$3 \$1$(printf "\n\r")\$4 \$3 \$1 \$2$(printf "\n\r")\$4 \$3 \$2 \$1" | tr -d "\r"'
alias rg_5S="rg -o '\S+\s+\S+\s+\S+\s+\S+\s+\S+'"
alias rg_5w="rg -o '(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})'"
alias rg_6S="rg -o '\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+'"
alias rg_6w="rg -o '(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})'"
alias rg_7S="rg -o '\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+'"
alias rg_7w="rg -o '(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})'"
alias rg_8S="rg -o '\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+'"
alias rg_8w="rg -o '(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})'"
alias rg_9S="rg -o '\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+'"
alias rg_9w="rg -o '(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})\W(\w{3,20})'"
alias rg_ww="tee >(rg_2w) >(rg_3w) >(rg_4w) >(rg_5w) >(rg_6w) >(rg_7w) >(rg_8w) >(rg_9w) >/dev/null"
### Ripgrep All
alias rgai="rga --color=never -I"
alias rgai-words="rga --color=never -I '\w+(\s\w+)+'"
### Sed
alias conv_rm_xml_tags="sed -e 's/<[^>]*>//g'"
alias conv_xml_tags_to_nl="sed -e 's/<[^>]*>/\n/g'"
### Sort
alias sort-fast="sort --parallel=40"
### Spellout
alias spellout-each="tee >(xargs spellout -a JAN) >(xargs spellout -a NATO) >(xargs spellout -a LAPD) >(xargs spellout -a WesternUnion) >(xargs spellout -a UsFinancial) >/dev/null | uniq"
### Tr (translate or delete characters).
alias conv_rm_punct="tr -s '[:punct:]' ' '"
alias conv_rm_blank="tr -d '[:blank:]'"
alias conv_to_at="tr ' ' '@'"
alias conv_to_alpha="tr -cd '[:alpha:]\n '"
alias conv_to_asterisk="tr ' ' '*'"
alias conv_to_braces="tr '()' '{}'"
alias conv_to_case_inv="tr '[:upper:][:lower:]' '[:lower:][:upper:]'"
alias conv_to_case_lower="tr '[:upper:]' '[:lower:]'"
alias conv_to_case_upper="tr '[:lower:]' '[:upper:]'"
alias conv_to_commas="tr ' ' ','"
alias conv_to_dashes="tr ' ' '-'"
alias conv_to_parenthesis="tr '{}' '()'"
alias conv_to_pipes="tr ' ' '|'"
alias conv_to_print="tr -cd '[:print:]\n'"
alias conv_to_slashes="tr ' ' '/'"
alias conv_to_spaces="tr -s '[:blank:]' ' '"
alias conv_to_stops="tr ' ' '.'"
alias conv_to_tildes="tr ' ' '^'"
alias conv_to_underscores="tr ' ' '_'"
## File system
# Enable color support of ls and also add handy aliases.
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
#
# ls variants
alias ls='\ls'
alias ll='\ls -alF'
alias llc='\ls -alh | lolcat'
alias llh='\ls -alh'
#alias lsd='ls -d .*'
#alias ls='ls $LS_OPTIONS'
alias la='ls $LS_OPTIONS -A'
alias l='ls $LS_OPTIONS -alFtr'
#alias l='ls $LS_OPTIONS -lA'
#alias l='ls $LS_OPTIONS -CF'
# Recursive directory listing
alias lr='ls -R | grep ":$" | sed -e '\''s/:$//'\'' -e '\''s/[^-][^\/]*\//--/g'\'' -e '\''s/^/ /'\'' -e '\''s/-/|/'\'''
# Unix like ls
#alias ll='ls -laF'
#alias ll='ls $LS_OPTIONS -alF' # Unix like ls
# Show which commands you use the most
alias freq='cut -f1 -d" " ~/.bash_history | sort | uniq -c | sort -nr | head -n 30'
# Allow to find the biggest file or directory in the current directory.
alias ds='du -ks *|sort -n'
# List top ten largest files/directories in current directory
alias big='du -ah . | sort -rh | head -40'
# List top ten largest files in current directory
alias big-files='ls -1Rhs | sed -e "s/^ *//" | grep "^[0-9]" | sort -hr | head -n40'
## ps aliases ##
alias ps-pgid="ps -o pid,ppid,pgid,command"
# What's gobbling the memory?
alias psmem='ps -o time,ppid,pid,nice,pcpu,pmem,user,comm -A | sort -n -k 6 | tail -15'
# rm variants
alias rm-bak="find . -name '*.bak' -type f -delete -print"
alias rm-ds="find . -name '.DS_Store' -type f -delete -print"
alias rm-empty-dirs="find . -type d -empty -delete -print"
alias rm-empty-files="find . -type f -empty -delete -print"
# Rsync
alias rsync-sudo='rsync --rsync-path="sudo rsync"'
alias rsync-mv="rsync --ignore-existing --remove-source-files -av"
# Date
alias date-iso="date --iso-8601=seconds"
# Permissions.
alias fix-file-perms="find * -type d -print0 | xargs -0 chmod 0755"
alias fix-dir-perms="find . -type f -print0 | xargs -0 chmod 0644"
# Getting colored results when using a pipe from grep to less.
alias grep='grep --color=auto'
alias less-color='less --use-color'
alias less='less -R'
alias rg-color='rg --color=always'
# Jump back n directories at a time
alias ..='cd ..'
alias ...='cd ../../'
alias ....='cd ../../../'
alias .....='cd ../../../../'
alias ......='cd ../../../../../'
## Git
# git branch
alias gb="git branch"
alias gba="git branch -a"
# git checkout master
alias gcm="git checkout master"
# git pull
alias gd="git diff"
alias gf="git fetch"
alias gfh="git fetch github"
alias gfo="git fetch origin"
alias gp="git pull"
alias gph="git pull github"
alias gphm="git pull github master"
alias gpo="git pull origin"
alias gpom="git pull origin master"
# Compact, colorized git log
alias gl="git log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
# Visualise git log (like gitk, in the terminal)
alias lg='git log --graph --full-history --all --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s"'
# Change dir to git root.
alias cdgit='cd "$(git rev-parse --show-toplevel 2> /dev/null)"'
# Refresh all repos in the current dir.
alias git-pull-all='find . -name .git -type d -execdir sh -c "git fetch --tags --all && git pull -v" ";"'
alias git-pull-root='find $(git rev-parse --show-toplevel 2> /dev/null) -name .git -type d -execdir git pull -v ";"'
# Docker
alias docker-run-ptrace="docker run --cap-add SYS_PTRACE"
alias mysql-docker-start="docker run --name=mysql -p3306:3306 --rm -v $HOME/.cache/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root} mysql/mysql-server"
# ImageMagick
alias identify-exif="identify -format '%[EXIF:*]'"
# JQ
alias jwt-decode="jq -R 'split(\".\") | .[1] | @base64d | fromjson'"
alias jq-all="jq -rR 'try fromjson catch .'"
# Kubernetes
alias k8="kubectl"
alias k="kubectl"
alias kgno="kubectl get nodes"
alias kgpo="kubectl get pods"
alias krmpo="kubectl remove pod"
# Pre-commit
alias pc="pre-commit run -a"
# Terraform
alias t="terraform"
alias ta="terraform apply"
alias tc="terraform console"
alias tf="terraform fmt"
alias ti="terraform init"
alias tiu="terraform init -upgrade"
alias to="terraform output"
alias tp="terraform plan"
alias ts="terraform state"
alias tsl="terraform state list"
alias tv="terraform validate"
#
# vim/vi/ex
alias v='vim'
alias trim="ex +'bufdo!%s/\s\+$//ge' -scxa" # Strip trailing whitespaces.
alias retab="ex +'set ts=2' +'bufdo retab' -scxa" # Convert tabs to spaces.
# npm
alias npm-freeze='npm ls | grep -o "\S\+@\S\+$" | tr @ " " | awk -v q='\''"'\'' '\''{print q$1q": "q"^"$2q","}'\'''
# Fun
alias lc=lolcat
alias weather-london="curl http://wttr.in/london"
# Transmission
alias magnet-add="transmission-remote -a"
alias magnet-list="transmission-remote -l"
alias tsm="transmission-remote"
alias tsm-show-config="transmission-daemon --dump-settings"
# Ansible
alias ansible-cowsay-off="export ANSIBLE_NOCOWS=true"
alias ansible-cowsay-on="export ANSIBLE_NOCOWS=false"
alias ansible-diff-off="export ANSIBLE_DIFF_ALWAYS=false"
alias ansible-diff-on="export ANSIBLE_DIFF_ALWAYS=true"
alias ansible-host-check-off="export ANSIBLE_HOST_KEY_CHECKING=false"
alias ansible-host-check-on="export ANSIBLE_HOST_KEY_CHECKING=true"
alias ansible-local="ansible-playbook -c local -i local, -M ."
alias ansible-run="ansible -m shell -a"
alias ansible-warnings-off="export ANSIBLE_DEPRECATION_WARNINGS=false"
alias ansible-warnings-on="export ANSIBLE_DEPRECATION_WARNINGS=true"
# Encoders
alias subtitle-convert-polish="enca -x utf8 -L polish"
alias urldecode='python3 -c "import urllib.parse; print(urllib.parse.unquote(input()))"'
alias urlencode='python3 -c "import urllib.parse;print (urllib.parse.quote(input()))"'
# Debugging
# Format strace output, see: http://stackoverflow.com/a/36557550/55075
alias format-strace='grep --line-buffered -o '\''".\+[^"]"'\'' | grep --line-buffered -o '\''[^"]*[^"]'\'' | while read -r line; do printf "%b" $line; done | tr "\r\n" "\275\276" | tr -d "[:cntrl:]" | tr "\275\276" "\r\n"'
## Downloading
#
# wget (if available)
alias wget-all='wget --user-agent=Mozilla -e robots=off --content-disposition --mirror --convert-links -E -K -N -r -c'
alias wget-html='wget --user-agent=Mozilla -e robots=off --content-disposition --mirror --convert-links -E -K -N -r -c --html-extension --reject-regex "(.*)\?(.*)"'
# Linters
alias jenkins-cli="ssh jenkins-cli"
alias jenkins-lint="ssh jenkins-cli declarative-linter < ./Jenkinsfile"
## Media
#
# youtube-dl/yt-dlp (if available)
alias youtube-dl='youtube-dl -vci -R5 -f "bv+ba" --write-description --write-info-json --all-subs --write-thumbnail --add-metadata'
alias yt-dlp='yt-dlp -vci -R5 -f "bv+ba" --write-description --write-info-json --all-subs --write-thumbnail --add-metadata'
alias yt-dlp-all='yt-dlp -vci -R5 -f "bv+ba" --retry-sleep 1 --write-description --write-info-json --all-subs --convert-subs srt --sleep-subtitles 10 --sub-format txt --write-auto-subs --write-subs --write-thumbnail --add-metadata --get-comments'
## Misc
alias randomize='fold -w1 | shuf | tr -d "\n"'
## MySQL
alias mysql-fix-collation='sed "s/utf8mb4_0900_ai_ci/utf8_general_ci/g;s/utf8mb4/utf8/g"'
alias mysql-tcp="mysql --protocol=TCP"
alias mysql-tcp-local="mysql --protocol=TCP"
alias mysql-fix-collation='sed "s/utf8mb4_0900_ai_ci\|utf8mb4_unicode_ci/utf8_general_ci/g;s/\butf8mb[34]/utf8/g"'
## Network
# Get external IP
alias whatismyip='curl ifconfig.me' # Or: ip.appspot.com
# Show active network listeners
alias netlisteners='lsof -i -P | grep LISTEN'
#
# Move torrent files
alias move_torrents='find . -name "*.torrent" -exec sh -c '\''DST=$(find . -type d -name "$(basename "{}" .torrent)" -print -quit); [ -d "$DST" ] && mv -v "{}" "$DST/"'\'' ";"'
# Load other alias files.
# Detect the platform.
case "$OSTYPE" in
darwin*) # macOS
# Load macOS specific aliases.
if [ -f ~/.aliasesrc_macos ]; then
source ~/.aliasesrc_macos
fi
;;
linux*) # Debian
# Load Linux specific aliases.
if [ -f ~/.aliasesrc_linux ]; then
source ~/.aliasesrc_linux
fi
;;
esac