aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2023-05-15 11:02:49 +0800
committerHsieh Chin Fan <pham@topo.tw>2023-05-15 11:02:49 +0800
commit696542a8bb5be7bed2797a1943dcb90e9ee39495 (patch)
tree309b1990944139d0d1cd9af045f962ab5e5281d2
parent5cbb08d04a2b862fe6d5343490a711e097ac7c56 (diff)
Update
-rw-r--r--alias41
1 files changed, 20 insertions, 21 deletions
diff --git a/alias b/alias
index 1f20ed7..1259c86 100644
--- a/alias
+++ b/alias
@@ -114,13 +114,13 @@ alias m='mutt'
114alias gmail="mutt -F $SETTING_DIR/mutt/muttrc.gmail" 114alias gmail="mutt -F $SETTING_DIR/mutt/muttrc.gmail"
115alias ntu="mutt -F $SETTING_DIR/mutt/muttrc.b97602041" 115alias ntu="mutt -F $SETTING_DIR/mutt/muttrc.b97602041"
116path() { echo $PATH; } # Should not use alias, because $PATH is not initialized 116path() { echo $PATH; } # Should not use alias, because $PATH is not initialized
117ps1.swap() { 117ps1.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}
125fd() { echo /proc/$$/fd; ls -l /proc/$$/fd; } 125fd() { echo /proc/$$/fd; ls -l /proc/$$/fd; }
126port() { sudo lsof -i :$1; } 126port() { sudo lsof -i :$1; }
@@ -176,6 +176,11 @@ file.size() {
176highlight() { grep --color -E "$1|\$"; } 176highlight() { grep --color -E "$1|\$"; }
177alias iso8601='date --iso-8601=minutes' 177alias iso8601='date --iso-8601=minutes'
178alias lock='sudo chattr +i' 178alias lock='sudo chattr +i'
179# Reset clock
180date.reset() {
181 sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
182}
183alias clock.reset='hwclock --systohc'
179 184
180 185
181# pacman 186# pacman
@@ -189,7 +194,7 @@ alias pss='pacman -Ss'
189alias yss='yay -Ss' 194alias yss='yay -Ss'
190alias pqi='pacman -Qi' 195alias pqi='pacman -Qi'
191alias pql='pacman -Qlq' 196alias pql='pacman -Qlq'
192pqlb() { 197pqlb() {
193 pacman -Qlq $1 | grep bin 198 pacman -Qlq $1 | grep bin
194} 199}
195alias yql='yay -Ql' 200alias yql='yay -Ql'
@@ -207,9 +212,9 @@ pkgbuild() { git clone https://aur.archlinux.org/$1.git; }
207# cd to DIRs 212# cd to DIRs
208alias ..='cd ..' 213alias ..='cd ..'
209alias ld='cd -' # last directory 214alias ld='cd -' # last directory
210cdg() { 215cdg() {
211 target=$(sed 's# #/#g' <<<"$@") 216 target=$(sed 's# #/#g' <<<"$@")
212 cd ~/git/$target || cd ~/git 217 cd ~/git/$target || cd ~/git
213} 218}
214alias cda='mkdir -p ~/data && cd ~/data' 219alias cda='mkdir -p ~/data && cd ~/data'
215alias cdd='cd ~/Downloads' 220alias cdd='cd ~/Downloads'
@@ -221,7 +226,7 @@ alias cdM='cd ~/Music'
221 226
222# blog 227# blog
223alias cdb='cd ~/blog' 228alias cdb='cd ~/blog'
224vp() { 229vp() {
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
359alias adb.camera='DIR=/sdcard/DCIM/Camera; adb pull $DIR/`adb shell ls -t $DIR | head -1` .' 364alias adb.camera='DIR=/sdcard/DCIM/Camera; adb pull $DIR/`adb shell ls -t $DIR | head -1` .'
360alias adb.camera='DIR=/sdcard/DCIM/Camera; adb pull $DIR/`adb shell ls -t $DIR | head -1` .' 365alias adb.camera='DIR=/sdcard/DCIM/Camera; adb pull $DIR/`adb shell ls -t $DIR | head -1` .'
361alias adb.input='adb shell input text' 366alias adb.input='adb shell input text'
362adb.push() { 367adb.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'
430alias xo='xsel -ob' 435alias xo='xsel -ob'
431alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && echo Copied to clipboard && xsel -ob' 436alias 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
434date-reset() {
435 sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
436}
437alias clock-reset='hwclock --systohc'
438
439# misc 438# misc
440alias foo='echo bar > foo && echo File foo is created && ls -lh foo' 439alias foo='echo bar > foo && echo File foo is created && ls -lh foo'
441alias bar='echo foo > bar && echo File bar is created && ls -lh bar' 440alias bar='echo foo > bar && echo File bar is created && ls -lh bar'
442unalias gr &>/dev/null 441unalias gr &>/dev/null
443gr() { 442gr() {
444 grep -IR $1 . 443 grep -IR $1 .
445} 444}
446alias wcl='wc -l' 445alias wcl='wc -l'
447alias findn='find . -iname' 446alias 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}
471big52utf8() { 470big52utf8() {
472 iconv -f BIG-5 -t UTF-8 471 iconv -f BIG-5 -t UTF-8
473} 472}
474utf82big5() { 473utf82big5() {
475 iconv -t BIG-5 -f UTF-8 474 iconv -t BIG-5 -f UTF-8
476} 475}
477urlencode() { 476urlencode() {
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'