diff options
-rw-r--r-- | alias | 87 |
1 files changed, 42 insertions, 45 deletions
@@ -95,26 +95,26 @@ prompt() { | |||
95 | rm $TMPFILE | 95 | rm $TMPFILE |
96 | } | 96 | } |
97 | file.sort() { | 97 | file.sort() { |
98 | find $1 -type f -print0 |\ | 98 | find $1 -type f -print0 |\ |
99 | xargs -0 ls --sort=size -lh |\ | 99 | xargs -0 ls --sort=size -lh |\ |
100 | head -20 | 100 | head -20 |
101 | } | 101 | } |
102 | file.size() { | 102 | file.size() { |
103 | find $1 -type f -print0 |\ | 103 | find $1 -type f -print0 |\ |
104 | xargs -0 ls -l |\ | 104 | xargs -0 ls -l |\ |
105 | awk '{ n=int(log($5)/log(2)); | 105 | awk '{ n=int(log($5)/log(2)); |
106 | if (n<10) n=10; | 106 | if (n<10) n=10; |
107 | size[n]++ } | 107 | size[n]++ } |
108 | END { for (i in size) printf("%d %d\n", 2^i, size[i]) | 108 | END { for (i in size) printf("%d %d\n", 2^i, size[i]) |
109 | }' |\ | 109 | }' |\ |
110 | sort -n |\ | 110 | sort -n |\ |
111 | awk 'function human(x) { x[1]/=1024; if (x[1]>=1024) { x[2]++; human(x) }} | 111 | awk 'function human(x) { x[1]/=1024; if (x[1]>=1024) { x[2]++; human(x) }} |
112 | { | 112 | { |
113 | a[1]=$1; | 113 | a[1]=$1; |
114 | a[2]=0; | 114 | a[2]=0; |
115 | human(a); | 115 | human(a); |
116 | printf("%3d%s: %6d\n", a[1],substr("kMGTEPYZ",a[2]+1,1),$2) | 116 | printf("%3d%s: %6d\n", a[1],substr("kMGTEPYZ",a[2]+1,1),$2) |
117 | }' | 117 | }' |
118 | } | 118 | } |
119 | highlight() { grep --color -E "$1|\$"; } | 119 | highlight() { grep --color -E "$1|\$"; } |
120 | 120 | ||
@@ -186,16 +186,17 @@ alias cdgg='cd $(git rev-parse --show-toplevel)' | |||
186 | alias cdgw='cdgg && cd .github/workflows' | 186 | alias cdgw='cdgg && cd .github/workflows' |
187 | alias cdgs='cd $(git submodule status | sed "s/^.//" | cut -d" " -f2)' # cd to first submodule | 187 | alias cdgs='cd $(git submodule status | sed "s/^.//" | cut -d" " -f2)' # cd to first submodule |
188 | check_repo() { | 188 | check_repo() { |
189 | cd $1 2>/dev/null || return 0 | 189 | cd $1 2>/dev/null || return 0 |
190 | echo check $1 | 190 | echo check $1 |
191 | git status -s | 191 | git status -s |
192 | [[ -n $(git cherry origin) ]] 2>/dev/null && print "\e[31m[ahead]\e[0m" | 192 | [[ -n $(git cherry origin) ]] 2>/dev/null && print "\e[31m[ahead]\e[0m" |
193 | } | 193 | } |
194 | check() { | 194 | check() { |
195 | check_repo $SETTING_DIR | 195 | check_repo $SETTING_DIR |
196 | check_repo $HOME/.password-store | 196 | check_repo $HOME/.password-store |
197 | check_repo $HOME/vimwiki | 197 | check_repo $HOME/vimwiki |
198 | check_repo $HOME/.task | 198 | check_repo $HOME/.task |
199 | check_repo $HOME/bean | ||
199 | } | 200 | } |
200 | alias ch='check' | 201 | alias ch='check' |
201 | 202 | ||
@@ -380,16 +381,16 @@ image.from_data_url() { | |||
380 | identify $1 | 381 | identify $1 |
381 | } | 382 | } |
382 | image.text() { | 383 | image.text() { |
383 | convert \ | 384 | convert \ |
384 | -size 230x130 \ | 385 | -size 230x130 \ |
385 | -background lightblue \ | 386 | -background lightblue \ |
386 | -font Noto-Sans-Bold \ | 387 | -font Noto-Sans-Bold \ |
387 | -pointsize 25 \ | 388 | -pointsize 25 \ |
388 | -fill black \ | 389 | -fill black \ |
389 | -gravity Center \ | 390 | -gravity Center \ |
390 | caption:"${1:=foo}" \ | 391 | caption:"${1:=foo}" \ |
391 | -flatten \ | 392 | -flatten \ |
392 | "${2:=foo}".jpg | 393 | "${2:=foo}".jpg |
393 | } | 394 | } |
394 | 395 | ||
395 | # Reset clock | 396 | # Reset clock |
@@ -446,13 +447,9 @@ urlencode() { | |||
446 | bak() { | 447 | bak() { |
447 | cp $1 $1.bak | 448 | cp $1 $1.bak |
448 | } | 449 | } |
449 | wrap2geojson() { | 450 | wrap2geojson() { jq -s '{ type: "FeatureCollection", features: . }'; } |
450 | jq -s '{ type: "FeatureCollection", features: . }' | ||
451 | } | ||
452 | alias cdtrash='cd ~/.local/share/Trash' | 451 | alias cdtrash='cd ~/.local/share/Trash' |
453 | trash() { | 452 | trash() { mv $@ ~/.local/share/Trash; } |
454 | mv $@ ~/.local/share/Trash | ||
455 | } | ||
456 | 453 | ||
457 | # task | 454 | # task |
458 | alias tk='task' | 455 | alias tk='task' |
@@ -470,11 +467,11 @@ tt() { | |||
470 | 467 | ||
471 | # upload with 0x0.st | 468 | # upload with 0x0.st |
472 | up() { | 469 | up() { |
473 | curl -F"file=@${1}" http://0x0.st | 470 | curl -F"file=@${1}" http://0x0.st |
474 | #curl -F "file=@${1}" https://api.anonfiles.com/upload | 471 | #curl -F "file=@${1}" https://api.anonfiles.com/upload |
475 | } | 472 | } |
476 | short() { | 473 | short() { |
477 | curl -F"shorten=${1}" http://0x0.st | 474 | curl -F"shorten=${1}" http://0x0.st |
478 | } | 475 | } |
479 | 476 | ||
480 | # pass | 477 | # pass |