aboutsummaryrefslogtreecommitdiffhomepage
path: root/alias
diff options
context:
space:
mode:
Diffstat (limited to 'alias')
-rw-r--r--alias74
1 files changed, 35 insertions, 39 deletions
diff --git a/alias b/alias
index 6532c1e..32fe1df 100644
--- a/alias
+++ b/alias
@@ -180,7 +180,10 @@ date.reset() {
180 sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z" 180 sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
181} 181}
182alias clock.reset='hwclock --systohc' 182alias clock.reset='hwclock --systohc'
183 183gr() {
184 grep -IR $1 .
185}
186alias findn='find . -iname'
184 187
185# pacman 188# pacman
186alias pac='sudo pacman -S' # pacman install 189alias pac='sudo pacman -S' # pacman install
@@ -222,9 +225,6 @@ alias cdP='cd ~/Pictures'
222alias cdpu='cd ~/public' 225alias cdpu='cd ~/public'
223alias cdV='cd ~/Videos' 226alias cdV='cd ~/Videos'
224alias cdM='cd ~/Music' 227alias cdM='cd ~/Music'
225alias cdmn='cd ~/git/maplibre-native/'
226alias cdmj='cd ~/git/maplibre-gl-js/'
227alias cdmx='cd ~/git/mapbox-gl-js/'
228 228
229# blog 229# blog
230alias cdb='cd ~/blog' 230alias cdb='cd ~/blog'
@@ -423,15 +423,29 @@ alias xii='`fc -ln -1` | head -1 | xsel -ib'
423alias xo='xsel -ob' 423alias xo='xsel -ob'
424alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && echo Copied to clipboard && xsel -ob' 424alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && echo Copied to clipboard && xsel -ob'
425 425
426# Text Encode/Decode
427big52utf8() {
428 iconv -f BIG-5 -t UTF-8
429}
430utf82big5() {
431 iconv -t BIG-5 -f UTF-8
432}
433urlencode() {
434 perl -lpe 's/([^A-Za-z0-9.\/:])/sprintf("%%%02X", ord($1))/seg'
435 # Alternative:
436 # curl -Gso /dev/null -w %{url_effective} --data-urlencode @- ""
437}
438
439# Network
440alias p8='ping -c 3 8.8.8.8'
441alias curl.google='curl -v google.com'
442alias curl.wifi='curl -I google.com | grep -E "^Location:" | cut -d" " -f2 | xsel -ib'
443
426# misc 444# misc
427alias foo='echo bar > foo && echo File foo is created && ls -lh foo' 445alias foo='echo bar > foo && echo File foo is created && ls -lh foo'
428alias bar='echo foo > bar && echo File bar is created && ls -lh bar' 446alias bar='echo foo > bar && echo File bar is created && ls -lh bar'
429unalias gr &>/dev/null 447unalias gr &>/dev/null
430gr() {
431 grep -IR $1 .
432}
433alias wcl='wc -l' 448alias wcl='wc -l'
434alias findn='find . -iname'
435alias x='xdg-open' 449alias x='xdg-open'
436alias yl='youtube-dl' 450alias yl='youtube-dl'
437alias yla='youtube-dl -x --audio-format mp3' 451alias yla='youtube-dl -x --audio-format mp3'
@@ -442,34 +456,18 @@ alias editor='select-editor'
442alias hp='http-prompt' 456alias hp='http-prompt'
443alias clocg='cloc --vcs=git' 457alias clocg='cloc --vcs=git'
444alias tma='tmux a' 458alias tma='tmux a'
445alias mm='mkvmerge -o out.webm -w 01.webm + 02.webm'
446alias we='weechat'
447alias p8='ping -c 3 8.8.8.8'
448alias curl.google='curl -v google.com'
449alias curl.wifi='curl -I google.com | grep -E "^Location:" | cut -d" " -f2 | xsel -ib'
450pbf() { 459pbf() {
451 protoc --decode_raw 460 protoc --decode_raw
452} 461}
453mvt.decode() { 462mvt.decode() {
454 if [[ ! -t 0 ]]; then 463 if [[ ! -t 0 ]]; then
455 tmp=$(mktemp)
456 cat >$tmp 464 cat >$tmp
465 tmp=$(mktemp)
457 else 466 else
458 tmp=$1 467 tmp=$1
459 fi 468 fi
460 mvt_decode.py $tmp | tr \' \" | sed 's/True/true/g' | jq . 469 mvt_decode.py $tmp | tr \' \" | sed 's/True/true/g' | jq .
461} 470}
462big52utf8() {
463 iconv -f BIG-5 -t UTF-8
464}
465utf82big5() {
466 iconv -t BIG-5 -f UTF-8
467}
468urlencode() {
469 perl -lpe 's/([^A-Za-z0-9.\/:])/sprintf("%%%02X", ord($1))/seg'
470 # Alternative:
471 # curl -Gso /dev/null -w %{url_effective} --data-urlencode @- ""
472}
473bak() { 471bak() {
474 cp $1 $1.bak 472 cp $1 $1.bak
475} 473}
@@ -480,8 +478,8 @@ alias ge='graph-easy --boxart'
480 478
481# pass 479# pass
482alias chp='tig -C ~/.password-store' 480alias chp='tig -C ~/.password-store'
483alias cdpass='cd ~/.password-store'
484alias chpass='tig -C ~/.password-store' 481alias chpass='tig -C ~/.password-store'
482alias cdpass='cd ~/.password-store'
485alias p='pass' 483alias p='pass'
486alias pc='pass -c' 484alias pc='pass -c'
487alias pe='pass edit' 485alias pe='pass edit'
@@ -496,22 +494,10 @@ alias vgx='sudo vim /etc/nginx/sites-enabled/vps && sudo nginx -t && sudo system
496alias cdngx='cd /etc/nginx' 494alias cdngx='cd /etc/nginx'
497 495
498# tmp 496# tmp
499alias cdS='cd ~/git/StreetComplete'
500alias cdm='cd ~/git/mapclay'
501alias cdma='cd ~/git/mapstew-android'
502alias cdT='cd ~/git/tilemaker'
503alias stew='cd ~/git/mapstew' 497alias stew='cd ~/git/mapstew'
504alias vc='vultr-cli' 498alias vc='vultr-cli'
505alias xkb='cd $SETTING_DIR && make xkb' 499alias xkb='cd $SETTING_DIR && make xkb'
506alias thsr='curl -L google.com >/tmp/foo.html && xdg-open /tmp/foo.html' 500alias thsr='curl -L google.com >/tmp/foo.html && xdg-open /tmp/foo.html'
507#hugo(){
508# docker run --rm \
509# -u `id -u`:`id -g` \
510# -v `pwd`:/src \
511# $EXTRA \
512# klakegg/hugo \
513# $@
514#}
515todo() { cd ~/log && grep -R ' TODO ' --exclude-dir=logseq/; } 501todo() { cd ~/log && grep -R ' TODO ' --exclude-dir=logseq/; }
516fix() { which $1 && grep -Po 'FIXME.*' $(which $1); } 502fix() { which $1 && grep -Po 'FIXME.*' $(which $1); }
517alias ffmpeg='ffmpeg -hide_banner' 503alias ffmpeg='ffmpeg -hide_banner'
@@ -519,8 +505,18 @@ alias md='reveal'
519alias terminal.color='printf "\e[%dm%d dark\e[0m \e[%d;1m%d bold\e[0m\n" {30..37}{,,,}' 505alias terminal.color='printf "\e[%dm%d dark\e[0m \e[%d;1m%d bold\e[0m\n" {30..37}{,,,}'
520alias gpg.bye='gpg-connect-agent reloadagent /bye' 506alias gpg.bye='gpg-connect-agent reloadagent /bye'
521 507
522 508# GIS
523TAIWAN_BBOX='118.1036,20.72799,122.9312,26.60305' 509TAIWAN_BBOX='118.1036,20.72799,122.9312,26.60305'
524TAIWAN_BBOX_V='20.72799,118.1036,26.60305,122.9312' 510TAIWAN_BBOX_V='20.72799,118.1036,26.60305,122.9312'
525TAIPEI_BBOX='121.346,24.926,121.676,25.209' 511TAIPEI_BBOX='121.346,24.926,121.676,25.209'
526TAIPEI_BBOX_V='24.926,121.346,25.209,121.676' 512TAIPEI_BBOX_V='24.926,121.346,25.209,121.676'
513
514# Comment out
515#alias mm='mkvmerge -o out.webm -w 01.webm + 02.webm'
516#alias we='weechat'
517
518LOCAL_ALIAS=~/.config/local.alias
519alias allo="$EDITOR $LOCAL_ALIAS && source $LOCAL_ALIAS"
520if [ -e $LOCAL_ALIAS ]; then
521 source $LOCAL_ALIAS
522fi