diff options
| author | typebrook <typebrook@gmail.com> | 2019-11-09 17:12:16 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2019-11-09 17:12:16 +0800 |
| commit | adc1c4462ad1c1d62dfc3e7caf95474da8724467 (patch) | |
| tree | ac73e75f8a18f51292e3ec052348c81def4173d2 /alias | |
| parent | e78266803bc1fa8d6e98e33bc82e8f4eb255160a (diff) | |
update
Diffstat (limited to 'alias')
| -rw-r--r-- | alias | 212 |
1 files changed, 0 insertions, 212 deletions
| @@ -1,212 +0,0 @@ | |||
| 1 | SETTING_DIR="$HOME/git/settings" | ||
| 2 | |||
| 3 | # settings | ||
| 4 | alias al='vim ~/.bash_aliases && source ~/.bash_aliases' | ||
| 5 | alias all='source ~/.bash_aliases' | ||
| 6 | alias bashrc='vim ~/.bashrc && source ~/.bashrc' | ||
| 7 | alias zshrc='vim ~/.zshrc && source ~/.zshrc' | ||
| 8 | alias vimrc='vim ~/.vimrc' | ||
| 9 | alias tigrc='vim $SETTING_DIR/tigrc' | ||
| 10 | alias gitconfig='vim ~/.gitconfig' | ||
| 11 | alias log='cat log | grep "`date +"%b %d"`"' | ||
| 12 | |||
| 13 | # vim | ||
| 14 | alias v='vim' | ||
| 15 | alias vv='vim ~/vimwiki/index.md' | ||
| 16 | wiki() { | ||
| 17 | cat ~/vimwiki/$1.md | ||
| 18 | } | ||
| 19 | alias ve='vim ~/.vim_runtime/my_configs.vim' | ||
| 20 | alias vr='vim -R' | ||
| 21 | alias cdv='cd ~/.vim_runtime' # amix/vimrc repo | ||
| 22 | |||
| 23 | # shell | ||
| 24 | alias src="source $HOME/.$(basename $SHELL)rc" | ||
| 25 | alias ll='ls -alh' | ||
| 26 | alias ai='sudo apt install' # apt install | ||
| 27 | alias si='sudo snap install' # snap install | ||
| 28 | alias ni='sudo npm install -g' # nodejs install | ||
| 29 | alias ss='sudo !!' | ||
| 30 | alias hg='history|grep' | ||
| 31 | alias rr='move_to_tmp' | ||
| 32 | move_to_tmp() { | ||
| 33 | mv $1 /tmp | ||
| 34 | } | ||
| 35 | |||
| 36 | # cd to DIRs | ||
| 37 | alias ..='cd ..' | ||
| 38 | alias ld='cd -' # last directory | ||
| 39 | alias cdg='cd ~/git' | ||
| 40 | alias cdd='cd ~/Downloads' | ||
| 41 | alias cdD='cd ~/Documents' | ||
| 42 | alias cdV='cd ~/Videos' | ||
| 43 | alias cdP='cd ~/Pictures' | ||
| 44 | |||
| 45 | # about custom settings | ||
| 46 | alias cds='cd $SETTING_DIR' | ||
| 47 | alias cdss='cd $SETTING_DIR/scripts' | ||
| 48 | alias chs='cd $SETTING_DIR && tig status' # check setting changes | ||
| 49 | |||
| 50 | # about vimwiki | ||
| 51 | alias cdw='cd ~/vimwiki' | ||
| 52 | alias chw='cd ~/vimwiki && tig' | ||
| 53 | alias ww='cd ~/vimwiki && git add * && git commit -am "update" && git push' | ||
| 54 | |||
| 55 | # crontab | ||
| 56 | alias ce='crontab -e' | ||
| 57 | |||
| 58 | # ranger | ||
| 59 | alias r='_ranger-cd' | ||
| 60 | alias ranrc='vim ~/.config/ranger/rc.conf' | ||
| 61 | _ranger-cd() { | ||
| 62 | tempfile="$(mktemp -t tmp.XXXXXX)" | ||
| 63 | ranger --choosedir="$tempfile" "${@:-$(pwd)}" | ||
| 64 | test -f "$tempfile" && | ||
| 65 | if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then | ||
| 66 | cd -- "$(cat "$tempfile")" | ||
| 67 | fi | ||
| 68 | rm -f -- "$tempfile" | ||
| 69 | } | ||
| 70 | |||
| 71 | # disk | ||
| 72 | alias df='df -h' | ||
| 73 | |||
| 74 | # git | ||
| 75 | alias gc='git clone' | ||
| 76 | alias gc1='git clone --depth=1' | ||
| 77 | gcg() { | ||
| 78 | git clone git@github.com:$1/$2.git | ||
| 79 | } | ||
| 80 | alias gls='git log -S' | ||
| 81 | alias cdgs='cd $(git submodule status | sed "s/^.//" | cut -d" " -f2)' # cd to first submodule | ||
| 82 | |||
| 83 | # docker | ||
| 84 | alias dp='docker ps' | ||
| 85 | alias dpa='docker ps -a' | ||
| 86 | alias di='docker images' | ||
| 87 | alias dc='docker-compose run --rm' | ||
| 88 | alias dstop='docker stop' | ||
| 89 | alias ds='docker stop' | ||
| 90 | alias drm='docker rm' | ||
| 91 | |||
| 92 | # ssh | ||
| 93 | alias keygen='ssh-keygen -t rsa -C "typebrook@gmail.com"' | ||
| 94 | alias topo='ssh typebrook@topo.tw' | ||
| 95 | alias ptt='ssh bbsu@ptt.cc' | ||
| 96 | alias geothings='ssh geothings@geobingan.info' | ||
| 97 | alias geothings-test='ssh geothings@test.geothings.tw' | ||
| 98 | |||
| 99 | # tig | ||
| 100 | alias cdt='cd ~/git/tig' | ||
| 101 | alias t='tig' | ||
| 102 | alias ts='tig status' | ||
| 103 | alias ta='tig --all' | ||
| 104 | alias get-tig='curl -LO https://github.com/typebrook/tig/releases/download/tig-2.4.1/tig' | ||
| 105 | alias upload-tig='$SETTING_DIR/scripts/upload-github-release-asset.sh github_api_token=$(head -1 $SETTING_DIR/tokens/github-release) owner=typebrook repo=tig tag=tig-2.4.1 filename=$(which tig)' | ||
| 106 | |||
| 107 | # Android | ||
| 108 | alias debug='./gradlew app:installDebug && adb shell am start -n com.geothings.geobingan/.MainActivity_' | ||
| 109 | alias adb-default='adb shell dumpsys package domain-preferred-apps' | ||
| 110 | alias adb-list='adb shell dumpsys package d' | ||
| 111 | alias rmcache='rm -rf ~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/*' | ||
| 112 | alias adb-last-screenshot='adb pull /sdcard/Screenshots/`adb shell ls -t /sdcard/Screenshots/ | head -1` ~/Desktop' | ||
| 113 | alias adb-push='adb push /sdcard/Download/' | ||
| 114 | |||
| 115 | # gist | ||
| 116 | gist_list=~/gist/gist.list | ||
| 117 | alias gl='nl $gist_list' | ||
| 118 | alias gll='gist -l > $gist_list && nl $gist_list' | ||
| 119 | alias gi='_gistRead' | ||
| 120 | alias gd='_gistDelete' | ||
| 121 | _gistRead() { | ||
| 122 | gist -r $(awk '{print $1}' $gist_list | awk -v row="$1" -F '/' 'FNR==row {print $NF}') $2 | ||
| 123 | } | ||
| 124 | _gistDelete() { | ||
| 125 | deleted=~/gist/deleted/$(date +"%s") | ||
| 126 | _gistRead $1 > $deleted && echo "backup at $deleted" | ||
| 127 | gist --delete $(awk '{print $1}' $gist_list | awk -v row="$1" -F '/' 'FNR==row {print $NF}') && \ | ||
| 128 | gll | ||
| 129 | } | ||
| 130 | |||
| 131 | # curl | ||
| 132 | alias co='curl -O' | ||
| 133 | alias curl.code='curl -o /dev/null --silent -Iw "%{http_code}"' | ||
| 134 | |||
| 135 | # python | ||
| 136 | alias pip3='python3 -m pip' | ||
| 137 | |||
| 138 | # gdal | ||
| 139 | alias oo='ogr2ogr' | ||
| 140 | alias oi='ogrinfo' | ||
| 141 | alias oias='ogrinfo -al -so' | ||
| 142 | |||
| 143 | # sample file | ||
| 144 | alias sample-gpx='curl -O https://docs.mapbox.com/help/data/run.gpx' | ||
| 145 | alias sample-geojson='curl -O https://docs.mapbox.com/help/data/stations.geojson' | ||
| 146 | alias sample-geotiff='curl -O https://docs.mapbox.com/help/data/landsat.tif' | ||
| 147 | alias sample-csv='curl -O https://docs.mapbox.com/help/data/airports.csv' | ||
| 148 | alias sample-svg='curl -O https://docs.mapbox.com/help/data/bicycle-24.svg' | ||
| 149 | alias sample-mbtiles='curl -O https://docs.mapbox.com/help/data/trails.mbtiles' | ||
| 150 | alias sample-kml='curl -O https://docs.mapbox.com/help/data/farmers_markets.kml' | ||
| 151 | |||
| 152 | # data file | ||
| 153 | alias taiwan='curl -O http://download.geofabrik.de/asia/taiwan-latest.osm.pbf' | ||
| 154 | alias data-taiwan-town='curl -o town.zip -L http://data.moi.gov.tw/MoiOD/System/DownloadFile.aspx\?DATA\=CD02C824-45C5-48C8-B631-98B205A2E35A' | ||
| 155 | alias data-taiwan-village='curl -o village.zip -L http://data.moi.gov.tw/MoiOD/System/DownloadFile.aspx\?DATA\=B8AF344F-B5C6-4642-AF46-1832054399CE' | ||
| 156 | alias data-rudymap='curl -O https://raw.githubusercontent.com/alpha-rudy/taiwan-topo/master/styles/mapsforge_style/MOI_OSM.xml' | ||
| 157 | alias data-osm-diff="curl https://planet.openstreetmap.org/replication/minute/state.txt |\ | ||
| 158 | sed -n 2p | cut -d'=' -f2 | sed -r 's/(.{1})(.{3})/00\1\/\2\//' |\ | ||
| 159 | xargs -I {} echo -e https://planet.openstreetmap.org/replication/minute/'{}'.osc.gz |\ | ||
| 160 | xargs curl -O" | ||
| 161 | |||
| 162 | # clipboard | ||
| 163 | alias xi='xsel -ib' | ||
| 164 | alias xo='xsel -ob' | ||
| 165 | alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && xsel -ob ' | ||
| 166 | alias xll='xo >> ~/vimwiki/working.md' | ||
| 167 | alias xc='xsel -ob | gcc -xc -' | ||
| 168 | |||
| 169 | # image | ||
| 170 | vertical() { | ||
| 171 | convert $@ -append output.png | ||
| 172 | } | ||
| 173 | |||
| 174 | # misc | ||
| 175 | alias gr='_grepString' | ||
| 176 | _grepString() { | ||
| 177 | grep -R $1 . | ||
| 178 | } | ||
| 179 | alias findn='find . -iname' | ||
| 180 | alias wcl='wc -l' | ||
| 181 | alias x='xdg-open' | ||
| 182 | alias f='free -h' | ||
| 183 | alias yl='youtube-dl' | ||
| 184 | alias yla='youtube-dl -x --audio-format mp3' | ||
| 185 | alias raw='echo "https://raw.githubusercontent.com" | xsel -ib && xsel -ob' | ||
| 186 | alias editor='select-editor' | ||
| 187 | alias hp='http-prompt' | ||
| 188 | alias clocg='cloc --vcs=git' | ||
| 189 | alias tma='tmux a' | ||
| 190 | alias mm='mkvmerge -o out.webm -w 01.webm + 02.webm' | ||
| 191 | alias du='ncdu' | ||
| 192 | alias we='weechat' | ||
| 193 | mvt_decode() { | ||
| 194 | python3 $SETTING_DIR/scripts/mvt_decode.py $1 | tr \' \" | sed 's/True/true/g' | jq . | ||
| 195 | } | ||
| 196 | big52utf8() { | ||
| 197 | iconv -f BIG-5 -t UTF-8 $1 > $1.utf8 | ||
| 198 | } | ||
| 199 | |||
| 200 | # tmp | ||
| 201 | alias cdo='cd ~/git/openmaptiles' | ||
| 202 | alias cdoo='cd ~/git/openmaptiles/styles/outdoor' | ||
| 203 | alias cdS='cd ~/git/StreetComplete' | ||
| 204 | alias cdW='cd ~/git/geoBingAnWeb' | ||
| 205 | alias and='cd ~/git/geoBingAn.Android' | ||
| 206 | alias cdG='cd ~/git/git' | ||
| 207 | alias cdp='cd ~/git/parse-style' | ||
| 208 | alias cdand='cd ~/git/sample' | ||
| 209 | |||
| 210 | repo='git@github.com' | ||
| 211 | hub='https://github.com' | ||
| 212 | typebrook='git@github.com:typebrook' | ||