diff options
author | typebrook <typebrook@gmail.com> | 2019-11-12 10:23:33 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2019-11-12 10:23:33 +0800 |
commit | 9fbb5894dd23e35168d2916d52ce17ff3ed20e2c (patch) | |
tree | 4da579490d86e4a48b7498f4fa5426afb6e1a545 /alias | |
parent | 7b27f297c6ac9b21b5611e49e38e37e32f01ecad (diff) |
update
Diffstat (limited to 'alias')
-rw-r--r-- | alias | 219 |
1 files changed, 219 insertions, 0 deletions
@@ -0,0 +1,219 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | # settings | ||
4 | alias al="vim $0 && source $0" | ||
5 | alias all="source $0" | ||
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 | upload-tig() { | ||
106 | $SETTING_DIR/scripts/upload-github-release-asset.sh \ | ||
107 | github_api_token=$(cat $HOME/.ssh/github) \ | ||
108 | owner=typebrook \ | ||
109 | repo=tig \ | ||
110 | tag=tig-2.4.1 \ | ||
111 | filename=$(which tig) | ||
112 | } | ||
113 | |||
114 | # Android | ||
115 | alias debug='./gradlew app:installDebug && adb shell am start -n com.geothings.geobingan/.MainActivity_' | ||
116 | alias adb-default='adb shell dumpsys package domain-preferred-apps' | ||
117 | alias adb-list='adb shell dumpsys package d' | ||
118 | alias rmcache='rm -rf ~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/*' | ||
119 | alias adb-last-screenshot='adb pull /sdcard/Screenshots/`adb shell ls -t /sdcard/Screenshots/ | head -1` ~/Desktop' | ||
120 | alias adb-push='adb push /sdcard/Download/' | ||
121 | |||
122 | # gist | ||
123 | gist_list=~/gist/gist.list | ||
124 | alias gl='nl $gist_list' | ||
125 | alias gll='gist -l > $gist_list && nl $gist_list' | ||
126 | alias gi='_gistRead' | ||
127 | alias gd='_gistDelete' | ||
128 | _gistRead() { | ||
129 | gist -r $(awk '{print $1}' $gist_list | awk -v row="$1" -F '/' 'FNR==row {print $NF}') $2 | ||
130 | } | ||
131 | _gistDelete() { | ||
132 | deleted=~/gist/deleted/$(date +"%s") | ||
133 | _gistRead $1 > $deleted && echo "backup at $deleted" | ||
134 | gist --delete $(awk '{print $1}' $gist_list | awk -v row="$1" -F '/' 'FNR==row {print $NF}') && \ | ||
135 | gll | ||
136 | } | ||
137 | |||
138 | # curl | ||
139 | alias co='curl -O' | ||
140 | alias curl.code='curl -o /dev/null --silent -Iw "%{http_code}"' | ||
141 | |||
142 | # python | ||
143 | alias pip3='python3 -m pip' | ||
144 | |||
145 | # gdal | ||
146 | alias oo='ogr2ogr' | ||
147 | alias oi='ogrinfo' | ||
148 | alias oias='ogrinfo -al -so' | ||
149 | |||
150 | # sample file | ||
151 | alias sample-gpx='curl -O https://docs.mapbox.com/help/data/run.gpx' | ||
152 | alias sample-geojson='curl -O https://docs.mapbox.com/help/data/stations.geojson' | ||
153 | alias sample-geotiff='curl -O https://docs.mapbox.com/help/data/landsat.tif' | ||
154 | alias sample-csv='curl -O https://docs.mapbox.com/help/data/airports.csv' | ||
155 | alias sample-svg='curl -O https://docs.mapbox.com/help/data/bicycle-24.svg' | ||
156 | alias sample-mbtiles='curl -O https://docs.mapbox.com/help/data/trails.mbtiles' | ||
157 | alias sample-kml='curl -O https://docs.mapbox.com/help/data/farmers_markets.kml' | ||
158 | |||
159 | # data file | ||
160 | alias taiwan='curl -O http://download.geofabrik.de/asia/taiwan-latest.osm.pbf' | ||
161 | alias data-taiwan-town='curl -o town.zip -L http://data.moi.gov.tw/MoiOD/System/DownloadFile.aspx\?DATA\=CD02C824-45C5-48C8-B631-98B205A2E35A' | ||
162 | alias data-taiwan-village='curl -o village.zip -L http://data.moi.gov.tw/MoiOD/System/DownloadFile.aspx\?DATA\=B8AF344F-B5C6-4642-AF46-1832054399CE' | ||
163 | alias data-rudymap='curl -O https://raw.githubusercontent.com/alpha-rudy/taiwan-topo/master/styles/mapsforge_style/MOI_OSM.xml' | ||
164 | alias data-osm-diff="curl https://planet.openstreetmap.org/replication/minute/state.txt |\ | ||
165 | sed -n 2p | cut -d'=' -f2 | sed -r 's/(.{1})(.{3})/00\1\/\2\//' |\ | ||
166 | xargs -I {} echo -e https://planet.openstreetmap.org/replication/minute/'{}'.osc.gz |\ | ||
167 | xargs curl -O" | ||
168 | |||
169 | # clipboard | ||
170 | alias xi='xsel -ib' | ||
171 | alias xo='xsel -ob' | ||
172 | alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && xsel -ob ' | ||
173 | alias xll='xo >> ~/vimwiki/working.md' | ||
174 | alias xc='xsel -ob | gcc -xc -' | ||
175 | |||
176 | # image | ||
177 | vertical() { | ||
178 | convert $@ -append output.png | ||
179 | } | ||
180 | |||
181 | # misc | ||
182 | alias gr='_grepString' | ||
183 | _grepString() { | ||
184 | grep -R $1 . | ||
185 | } | ||
186 | alias findn='find . -iname' | ||
187 | alias wcl='wc -l' | ||
188 | alias x='xdg-open' | ||
189 | alias f='free -h' | ||
190 | alias yl='youtube-dl' | ||
191 | alias yla='youtube-dl -x --audio-format mp3' | ||
192 | alias raw='echo "https://raw.githubusercontent.com" | xsel -ib && xsel -ob' | ||
193 | alias editor='select-editor' | ||
194 | alias hp='http-prompt' | ||
195 | alias clocg='cloc --vcs=git' | ||
196 | alias tma='tmux a' | ||
197 | alias mm='mkvmerge -o out.webm -w 01.webm + 02.webm' | ||
198 | alias du='ncdu' | ||
199 | alias we='weechat' | ||
200 | mvt_decode() { | ||
201 | python3 $SETTING_DIR/scripts/mvt_decode.py $1 | tr \' \" | sed 's/True/true/g' | jq . | ||
202 | } | ||
203 | big52utf8() { | ||
204 | iconv -f BIG-5 -t UTF-8 $1 > $1.utf8 | ||
205 | } | ||
206 | |||
207 | # tmp | ||
208 | alias cdo='cd ~/git/openmaptiles' | ||
209 | alias cdoo='cd ~/git/openmaptiles/styles/outdoor' | ||
210 | alias cdS='cd ~/git/StreetComplete' | ||
211 | alias cdW='cd ~/git/geoBingAnWeb' | ||
212 | alias and='cd ~/git/geoBingAn.Android' | ||
213 | alias cdG='cd ~/git/git' | ||
214 | alias cdp='cd ~/git/parse-style' | ||
215 | alias cdand='cd ~/git/sample' | ||
216 | |||
217 | repo='git@github.com' | ||
218 | hub='https://github.com' | ||
219 | typebrook='git@github.com:typebrook' | ||