From 6532894e80e06f665de0845a9465b09ea6d2099e Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Fri, 27 May 2022 12:44:27 +0800 Subject: Update --- alias | 87 ++++++++++++++++++++++++++++++++----------------------------------- 1 file changed, 42 insertions(+), 45 deletions(-) (limited to 'alias') diff --git a/alias b/alias index 3cf1371..eceedcc 100644 --- a/alias +++ b/alias @@ -95,26 +95,26 @@ prompt() { rm $TMPFILE } file.sort() { - find $1 -type f -print0 |\ - xargs -0 ls --sort=size -lh |\ - head -20 + find $1 -type f -print0 |\ + xargs -0 ls --sort=size -lh |\ + head -20 } file.size() { - find $1 -type f -print0 |\ - xargs -0 ls -l |\ - awk '{ n=int(log($5)/log(2)); - if (n<10) n=10; - size[n]++ } - END { for (i in size) printf("%d %d\n", 2^i, size[i]) - }' |\ - sort -n |\ - awk 'function human(x) { x[1]/=1024; if (x[1]>=1024) { x[2]++; human(x) }} - { - a[1]=$1; - a[2]=0; - human(a); - printf("%3d%s: %6d\n", a[1],substr("kMGTEPYZ",a[2]+1,1),$2) - }' + find $1 -type f -print0 |\ + xargs -0 ls -l |\ + awk '{ n=int(log($5)/log(2)); + if (n<10) n=10; + size[n]++ } + END { for (i in size) printf("%d %d\n", 2^i, size[i]) + }' |\ + sort -n |\ + awk 'function human(x) { x[1]/=1024; if (x[1]>=1024) { x[2]++; human(x) }} + { + a[1]=$1; + a[2]=0; + human(a); + printf("%3d%s: %6d\n", a[1],substr("kMGTEPYZ",a[2]+1,1),$2) + }' } highlight() { grep --color -E "$1|\$"; } @@ -186,16 +186,17 @@ alias cdgg='cd $(git rev-parse --show-toplevel)' alias cdgw='cdgg && cd .github/workflows' alias cdgs='cd $(git submodule status | sed "s/^.//" | cut -d" " -f2)' # cd to first submodule check_repo() { - cd $1 2>/dev/null || return 0 - echo check $1 - git status -s - [[ -n $(git cherry origin) ]] 2>/dev/null && print "\e[31m[ahead]\e[0m" + cd $1 2>/dev/null || return 0 + echo check $1 + git status -s + [[ -n $(git cherry origin) ]] 2>/dev/null && print "\e[31m[ahead]\e[0m" } check() { - check_repo $SETTING_DIR - check_repo $HOME/.password-store - check_repo $HOME/vimwiki - check_repo $HOME/.task + check_repo $SETTING_DIR + check_repo $HOME/.password-store + check_repo $HOME/vimwiki + check_repo $HOME/.task + check_repo $HOME/bean } alias ch='check' @@ -380,16 +381,16 @@ image.from_data_url() { identify $1 } image.text() { - convert \ - -size 230x130 \ - -background lightblue \ - -font Noto-Sans-Bold \ - -pointsize 25 \ - -fill black \ - -gravity Center \ - caption:"${1:=foo}" \ - -flatten \ - "${2:=foo}".jpg + convert \ + -size 230x130 \ + -background lightblue \ + -font Noto-Sans-Bold \ + -pointsize 25 \ + -fill black \ + -gravity Center \ + caption:"${1:=foo}" \ + -flatten \ + "${2:=foo}".jpg } # Reset clock @@ -446,13 +447,9 @@ urlencode() { bak() { cp $1 $1.bak } -wrap2geojson() { - jq -s '{ type: "FeatureCollection", features: . }' -} +wrap2geojson() { jq -s '{ type: "FeatureCollection", features: . }'; } alias cdtrash='cd ~/.local/share/Trash' -trash() { - mv $@ ~/.local/share/Trash -} +trash() { mv $@ ~/.local/share/Trash; } # task alias tk='task' @@ -470,11 +467,11 @@ tt() { # upload with 0x0.st up() { - curl -F"file=@${1}" http://0x0.st - #curl -F "file=@${1}" https://api.anonfiles.com/upload + curl -F"file=@${1}" http://0x0.st + #curl -F "file=@${1}" https://api.anonfiles.com/upload } short() { - curl -F"shorten=${1}" http://0x0.st + curl -F"shorten=${1}" http://0x0.st } # pass -- cgit v1.2.3-70-g09d2