diff options
-rw-r--r-- | alias | 41 |
1 files changed, 20 insertions, 21 deletions
@@ -114,13 +114,13 @@ alias m='mutt' | |||
114 | alias gmail="mutt -F $SETTING_DIR/mutt/muttrc.gmail" | 114 | alias gmail="mutt -F $SETTING_DIR/mutt/muttrc.gmail" |
115 | alias ntu="mutt -F $SETTING_DIR/mutt/muttrc.b97602041" | 115 | alias ntu="mutt -F $SETTING_DIR/mutt/muttrc.b97602041" |
116 | path() { echo $PATH; } # Should not use alias, because $PATH is not initialized | 116 | path() { echo $PATH; } # Should not use alias, because $PATH is not initialized |
117 | ps1.swap() { | 117 | ps1.swap() { |
118 | if [ -z "$PS1_bak" ]; then PS1_bak="$PS1" | 118 | if [ -z "$PS1_bak" ]; then PS1_bak="$PS1" |
119 | PS1="${1:->}" | 119 | PS1="${1:->}" |
120 | PS1="${PS1%% } " | 120 | PS1="${PS1%% } " |
121 | else PS1="$PS1_bak" | 121 | else PS1="$PS1_bak" |
122 | unset PS1_bak | 122 | unset PS1_bak |
123 | fi | 123 | fi |
124 | } | 124 | } |
125 | fd() { echo /proc/$$/fd; ls -l /proc/$$/fd; } | 125 | fd() { echo /proc/$$/fd; ls -l /proc/$$/fd; } |
126 | port() { sudo lsof -i :$1; } | 126 | port() { sudo lsof -i :$1; } |
@@ -176,6 +176,11 @@ file.size() { | |||
176 | highlight() { grep --color -E "$1|\$"; } | 176 | highlight() { grep --color -E "$1|\$"; } |
177 | alias iso8601='date --iso-8601=minutes' | 177 | alias iso8601='date --iso-8601=minutes' |
178 | alias lock='sudo chattr +i' | 178 | alias lock='sudo chattr +i' |
179 | # Reset clock | ||
180 | date.reset() { | ||
181 | sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z" | ||
182 | } | ||
183 | alias clock.reset='hwclock --systohc' | ||
179 | 184 | ||
180 | 185 | ||
181 | # pacman | 186 | # pacman |
@@ -189,7 +194,7 @@ alias pss='pacman -Ss' | |||
189 | alias yss='yay -Ss' | 194 | alias yss='yay -Ss' |
190 | alias pqi='pacman -Qi' | 195 | alias pqi='pacman -Qi' |
191 | alias pql='pacman -Qlq' | 196 | alias pql='pacman -Qlq' |
192 | pqlb() { | 197 | pqlb() { |
193 | pacman -Qlq $1 | grep bin | 198 | pacman -Qlq $1 | grep bin |
194 | } | 199 | } |
195 | alias yql='yay -Ql' | 200 | alias yql='yay -Ql' |
@@ -207,9 +212,9 @@ pkgbuild() { git clone https://aur.archlinux.org/$1.git; } | |||
207 | # cd to DIRs | 212 | # cd to DIRs |
208 | alias ..='cd ..' | 213 | alias ..='cd ..' |
209 | alias ld='cd -' # last directory | 214 | alias ld='cd -' # last directory |
210 | cdg() { | 215 | cdg() { |
211 | target=$(sed 's# #/#g' <<<"$@") | 216 | target=$(sed 's# #/#g' <<<"$@") |
212 | cd ~/git/$target || cd ~/git | 217 | cd ~/git/$target || cd ~/git |
213 | } | 218 | } |
214 | alias cda='mkdir -p ~/data && cd ~/data' | 219 | alias cda='mkdir -p ~/data && cd ~/data' |
215 | alias cdd='cd ~/Downloads' | 220 | alias cdd='cd ~/Downloads' |
@@ -221,7 +226,7 @@ alias cdM='cd ~/Music' | |||
221 | 226 | ||
222 | # blog | 227 | # blog |
223 | alias cdb='cd ~/blog' | 228 | alias cdb='cd ~/blog' |
224 | vp() { | 229 | vp() { |
225 | [[ $HOST = vultr ]] || PREFIX='ssh -qt vps' | 230 | [[ $HOST = vultr ]] || PREFIX='ssh -qt vps' |
226 | 231 | ||
227 | filename="${1%.md}.md" | 232 | filename="${1%.md}.md" |
@@ -359,8 +364,8 @@ alias adb.screenshot='DIR=/sdcard/Pictures/Screenshots/; adb pull $DIR/`adb shel | |||
359 | alias adb.camera='DIR=/sdcard/DCIM/Camera; adb pull $DIR/`adb shell ls -t $DIR | head -1` .' | 364 | alias adb.camera='DIR=/sdcard/DCIM/Camera; adb pull $DIR/`adb shell ls -t $DIR | head -1` .' |
360 | alias adb.camera='DIR=/sdcard/DCIM/Camera; adb pull $DIR/`adb shell ls -t $DIR | head -1` .' | 365 | alias adb.camera='DIR=/sdcard/DCIM/Camera; adb pull $DIR/`adb shell ls -t $DIR | head -1` .' |
361 | alias adb.input='adb shell input text' | 366 | alias adb.input='adb shell input text' |
362 | adb.push() { | 367 | adb.push() { |
363 | adb push $1 /sdcard/Download | 368 | adb push $1 /sdcard/Download |
364 | } | 369 | } |
365 | 370 | ||
366 | # curl | 371 | # curl |
@@ -430,18 +435,12 @@ alias xii='`fc -ln -1` | head -1 | xsel -ib' | |||
430 | alias xo='xsel -ob' | 435 | alias xo='xsel -ob' |
431 | alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && echo Copied to clipboard && xsel -ob' | 436 | alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && echo Copied to clipboard && xsel -ob' |
432 | 437 | ||
433 | # Reset clock | ||
434 | date-reset() { | ||
435 | sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z" | ||
436 | } | ||
437 | alias clock-reset='hwclock --systohc' | ||
438 | |||
439 | # misc | 438 | # misc |
440 | alias foo='echo bar > foo && echo File foo is created && ls -lh foo' | 439 | alias foo='echo bar > foo && echo File foo is created && ls -lh foo' |
441 | alias bar='echo foo > bar && echo File bar is created && ls -lh bar' | 440 | alias bar='echo foo > bar && echo File bar is created && ls -lh bar' |
442 | unalias gr &>/dev/null | 441 | unalias gr &>/dev/null |
443 | gr() { | 442 | gr() { |
444 | grep -IR $1 . | 443 | grep -IR $1 . |
445 | } | 444 | } |
446 | alias wcl='wc -l' | 445 | alias wcl='wc -l' |
447 | alias findn='find . -iname' | 446 | alias findn='find . -iname' |
@@ -468,11 +467,11 @@ mvt.decode() { | |||
468 | fi | 467 | fi |
469 | mvt_decode.py $tmp | tr \' \" | sed 's/True/true/g' | jq . | 468 | mvt_decode.py $tmp | tr \' \" | sed 's/True/true/g' | jq . |
470 | } | 469 | } |
471 | big52utf8() { | 470 | big52utf8() { |
472 | iconv -f BIG-5 -t UTF-8 | 471 | iconv -f BIG-5 -t UTF-8 |
473 | } | 472 | } |
474 | utf82big5() { | 473 | utf82big5() { |
475 | iconv -t BIG-5 -f UTF-8 | 474 | iconv -t BIG-5 -f UTF-8 |
476 | } | 475 | } |
477 | urlencode() { | 476 | urlencode() { |
478 | perl -lpe 's/([^A-Za-z0-9.\/:])/sprintf("%%%02X", ord($1))/seg' | 477 | perl -lpe 's/([^A-Za-z0-9.\/:])/sprintf("%%%02X", ord($1))/seg' |