diff options
author | typebrook <typebrook@gmail.com> | 2020-02-05 20:48:23 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2020-02-05 20:48:23 +0800 |
commit | 7cd2078840eafa8eebfd8eadde89015b73f15a63 (patch) | |
tree | 642754105e00e925d798e2cb1b9bdce9696eb8da | |
parent | aa9ebaf1ab4b234a07de64f3965bdf74caaea6e6 (diff) |
update
-rw-r--r-- | alias | 120 |
1 files changed, 59 insertions, 61 deletions
@@ -20,13 +20,13 @@ alias cdv='cd ~/.vim_runtime' # amix/vimrc repo | |||
20 | 20 | ||
21 | # script | 21 | # script |
22 | vs() { | 22 | vs() { |
23 | ( which $1 ) && vim $(which $1) | 23 | ( which $1 ) && vim $(which $1) |
24 | } | 24 | } |
25 | todo() { | 25 | todo() { |
26 | ( which $1 ) && grep -Po 'TODO.*' $(which $1) | 26 | ( which $1 ) && grep -Po 'TODO.*' $(which $1) |
27 | } | 27 | } |
28 | fix() { | 28 | fix() { |
29 | ( which $1 ) && grep -Po 'FIXME.*' $(which $1) | 29 | ( which $1 ) && grep -Po 'FIXME.*' $(which $1) |
30 | } | 30 | } |
31 | cdgi() { | 31 | cdgi() { |
32 | dir=$(gist $1 --no-action) | 32 | dir=$(gist $1 --no-action) |
@@ -40,13 +40,13 @@ alias hg='history | grep' | |||
40 | alias rmrf='rm -rf' | 40 | alias rmrf='rm -rf' |
41 | alias rr='move_to_tmp' | 41 | alias rr='move_to_tmp' |
42 | move_to_tmp() { | 42 | move_to_tmp() { |
43 | mv $@ /tmp | 43 | mv $@ /tmp |
44 | } | 44 | } |
45 | prompt() { | 45 | prompt() { |
46 | TMPFILE=$(mktemp); echo -e $1 > $TMPFILE && \ | 46 | TMPFILE=$(mktemp); echo -e $1 > $TMPFILE && \ |
47 | vim $TMPFILE && \ | 47 | vim $TMPFILE && \ |
48 | sed -i '$ q; s/$/ \\/' $TMPFILE && \ | 48 | sed -i '$ q; s/$/ \\/' $TMPFILE && \ |
49 | eval $(cat $TMPFILE | tee /dev/tty) | 49 | eval $(cat $TMPFILE | tee /dev/tty) |
50 | } | 50 | } |
51 | 51 | ||
52 | # package | 52 | # package |
@@ -60,7 +60,7 @@ alias pi='sudo pip3 install' # nodejs install | |||
60 | alias ..='cd ..' | 60 | alias ..='cd ..' |
61 | alias ld='cd -' # last directory | 61 | alias ld='cd -' # last directory |
62 | cdg() { | 62 | cdg() { |
63 | cd ~/git/$1 || cd ~/git | 63 | cd ~/git/$1 || cd ~/git |
64 | } | 64 | } |
65 | alias cda='cd ~/data' | 65 | alias cda='cd ~/data' |
66 | alias cdd='cd ~/Downloads' | 66 | alias cdd='cd ~/Downloads' |
@@ -82,12 +82,8 @@ alias chs='cd $SETTING_DIR && tig status' # check setting changes | |||
82 | alias cdw='cd ~/vimwiki' | 82 | alias cdw='cd ~/vimwiki' |
83 | alias chw='cd ~/vimwiki && tig --all' | 83 | alias chw='cd ~/vimwiki && tig --all' |
84 | alias ww='cd ~/vimwiki && git add * && git commit -am "update" && git push' | 84 | alias ww='cd ~/vimwiki && git add * && git commit -am "update" && git push' |
85 | wg() { | 85 | wg() { vim ~/vimwiki/$1.md } |
86 | vim ~/vimwiki/$1.md | 86 | wi() { cat ~/vimwiki/$1.md } |
87 | } | ||
88 | wi() { | ||
89 | cat ~/vimwiki/$1.md | ||
90 | } | ||
91 | 87 | ||
92 | # crontab | 88 | # crontab |
93 | alias ce='crontab -e' | 89 | alias ce='crontab -e' |
@@ -96,13 +92,13 @@ alias ce='crontab -e' | |||
96 | alias r='_ranger_cd' | 92 | alias r='_ranger_cd' |
97 | alias ranrc='vim ~/.config/ranger/rc.conf' | 93 | alias ranrc='vim ~/.config/ranger/rc.conf' |
98 | _ranger_cd() { | 94 | _ranger_cd() { |
99 | tempfile="$(mktemp -t tmp.XXXXXX)" | 95 | tempfile="$(mktemp -t tmp.XXXXXX)" |
100 | ranger --choosedir="$tempfile" "${@:-$(pwd)}" | 96 | ranger --choosedir="$tempfile" "${@:-$(pwd)}" |
101 | test -f "$tempfile" && | 97 | test -f "$tempfile" && |
102 | if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then | 98 | if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then |
103 | cd -- "$(cat "$tempfile")" | 99 | cd -- "$(cat "$tempfile")" |
104 | fi | 100 | fi |
105 | rm -f -- "$tempfile" | 101 | rm -f -- "$tempfile" |
106 | } | 102 | } |
107 | 103 | ||
108 | # disk | 104 | # disk |
@@ -111,20 +107,20 @@ alias df='df -h' | |||
111 | # git | 107 | # git |
112 | unalias gc &> /dev/null # override zsh plugin alias | 108 | unalias gc &> /dev/null # override zsh plugin alias |
113 | gc() { | 109 | gc() { |
114 | git clone $1 && cd $(basename $1) | 110 | git clone $1 && cd $(basename $1) |
115 | } | 111 | } |
116 | gc1() { | 112 | gc1() { |
117 | git clone --depth=1 $1 && cd $(basename $1) | 113 | git clone --depth=1 $1 && cd $(basename $1) |
118 | } | 114 | } |
119 | gcg() { | 115 | gcg() { |
120 | git clone git@github.com:$1/$2.git && cd $(basename $2) | 116 | git clone git@github.com:$1/$2.git && cd $(basename $2) |
121 | } | 117 | } |
122 | alias gls='git log -S' | 118 | alias gls='git log -S' |
123 | alias cdgw='cd .github/workflows' | 119 | alias cdgw='cd .github/workflows' |
124 | alias cdgs='cd $(git submodule status | sed "s/^.//" | cut -d" " -f2)' # cd to first submodule | 120 | alias cdgs='cd $(git submodule status | sed "s/^.//" | cut -d" " -f2)' # cd to first submodule |
125 | github_release_asset() { | 121 | github_release_asset() { |
126 | command="upload-github-release-asset.sh\n github_api_token=$(cat ~/settings/tokens/github)\n owner=typebrook\n repo=tig\n tag=LATEST\n filename=$(which tig)\n overwrite=false" | 122 | command="upload-github-release-asset.sh\n github_api_token=$(cat ~/settings/tokens/github)\n owner=typebrook\n repo=tig\n tag=LATEST\n filename=$(which tig)\n overwrite=false" |
127 | prompt "$command" | 123 | prompt "$command" |
128 | } | 124 | } |
129 | 125 | ||
130 | # docker | 126 | # docker |
@@ -150,23 +146,23 @@ alias ts='tig status' | |||
150 | alias ta='tig --all' | 146 | alias ta='tig --all' |
151 | alias get-tig='curl -LO https://github.com/typebrook/tig/releases/download/tig-2.5.0/tig' | 147 | alias get-tig='curl -LO https://github.com/typebrook/tig/releases/download/tig-2.5.0/tig' |
152 | upload_tig() { | 148 | upload_tig() { |
153 | upload-github-release-asset.sh \ | 149 | upload-github-release-asset.sh \ |
154 | github_api_token=$(cat ~/settings/tokens/github) \ | 150 | github_api_token=$(cat ~/settings/tokens/github) \ |
155 | owner=typebrook \ | 151 | owner=typebrook \ |
156 | repo=tig \ | 152 | repo=tig \ |
157 | tag=LATEST \ | 153 | tag=LATEST \ |
158 | filename=$(which tig) | 154 | filename=$(which tig) |
159 | overwrite=false | 155 | overwrite=false |
160 | } | 156 | } |
161 | 157 | ||
162 | # Android | 158 | # Android |
163 | alias debug='./gradlew app:installDebug && adb shell am start -n com.geothings.geobingan/.MainActivity_' | 159 | alias debug='./gradlew app:installDebug && adb shell am start -n com.geothings.geobingan/.MainActivity_' |
164 | alias adb-default='adb shell dumpsys package domain-preferred-apps' | 160 | alias adb_default='adb shell dumpsys package domain-preferred-apps' |
165 | alias adb-list='adb shell dumpsys package d' | 161 | alias adb_list='adb shell dumpsys package d' |
166 | alias rmcache='rm -rf ~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/*' | 162 | alias rmcache='rm -rf ~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/*' |
167 | alias adb-last-screenshot='adb pull /sdcard/Screenshots/`adb shell ls -t /sdcard/Screenshots/ | head -1` ~/Desktop' | 163 | alias adb_last_screenshot='adb pull /sdcard/Screenshots/`adb shell ls -t /sdcard/Screenshots/ | head -1` ~/Desktop' |
168 | adb_push() { | 164 | adb_push() { |
169 | adb push $1 /sdcard/Download | 165 | adb push $1 /sdcard/Download |
170 | } | 166 | } |
171 | 167 | ||
172 | # curl | 168 | # curl |
@@ -182,27 +178,29 @@ alias oi='ogrinfo' | |||
182 | alias oias='ogrinfo -al -so' | 178 | alias oias='ogrinfo -al -so' |
183 | 179 | ||
184 | # sample file | 180 | # sample file |
185 | alias sample-gpx='curl -O https://docs.mapbox.com/help/data/run.gpx' | 181 | alias sample_gpx='curl -O https://docs.mapbox.com/help/data/run.gpx' |
186 | alias sample-geojson='curl -O https://docs.mapbox.com/help/data/stations.geojson' | 182 | alias sample_geojson='curl -O https://docs.mapbox.com/help/data/stations.geojson' |
187 | alias sample-geotiff='curl -O https://docs.mapbox.com/help/data/landsat.tif' | 183 | alias sample_geotiff='curl -O https://docs.mapbox.com/help/data/landsat.tif' |
188 | alias sample-csv='curl -O https://docs.mapbox.com/help/data/airports.csv' | 184 | alias sample_csv='curl -O https://docs.mapbox.com/help/data/airports.csv' |
189 | alias sample-svg='curl -O https://docs.mapbox.com/help/data/bicycle-24.svg' | 185 | alias sample_svg='curl -O https://docs.mapbox.com/help/data/bicycle-24.svg' |
190 | alias sample-mbtiles='curl -O https://docs.mapbox.com/help/data/trails.mbtiles' | 186 | alias sample_mbtiles='curl -O https://docs.mapbox.com/help/data/trails.mbtiles' |
191 | alias sample-kml='curl -O https://docs.mapbox.com/help/data/farmers_markets.kml' | 187 | alias sample_kml='curl -O https://docs.mapbox.com/help/data/farmers_markets.kml' |
192 | alias sample-osm='curl https://api.openstreetmap.org/api/0.6/node/3428095932' | 188 | alias sample_osm='curl https://api.openstreetmap.org/api/0.6/node/3428095932' |
193 | 189 | ||
194 | # data file | 190 | # data file |
195 | alias taiwan='curl -O http://download.geofabrik.de/asia/taiwan-latest.osm.pbf' | 191 | alias taiwan='curl -O http://download.geofabrik.de/asia/taiwan-latest.osm.pbf' |
196 | alias data-rudymap='curl -O https://raw.githubusercontent.com/alpha-rudy/taiwan-topo/master/styles/mapsforge_style/MOI_OSM.xml' | 192 | alias data_rudymap='curl -O https://raw.githubusercontent.com/alpha-rudy/taiwan-topo/master/styles/mapsforge_style/MOI_OSM.xml' |
197 | alias data-rudymap-ele='curl -O http://moi.kcwu.csie.org/osm_elevations/ele_taiwan_10_50_100_500_marker-2019.7.o5m' | 193 | alias data_rudymap_ele='curl -O http://moi.kcwu.csie.org/osm_elevations/ele_taiwan_10_50_100_500_marker-2019.7.o5m' |
198 | alias data-osm-diff="curl https://planet.openstreetmap.org/replication/minute/state.txt |\ | 194 | data_osm_diff() { |
199 | sed -n 2p | cut -d'=' -f2 | sed -r 's/(.{1})(.{3})/00\1\/\2\//' |\ | 195 | curl https://planet.openstreetmap.org/replication/minute/state.txt \ |
200 | xargs -I {} echo -e https://planet.openstreetmap.org/replication/minute/'{}'.osc.gz |\ | 196 | | sed -n 2p | cut -d'=' -f2 | sed -r 's/(.{1})(.{3})/00\1\/\2\//' \ |
201 | xargs curl -O" | 197 | | xargs -I{} echo 'https://planet.openstreetmap.org/replication/minute/{}'.osc.gz \ |
202 | alias data-taiwan-town='curl -o town.zip -L http://data.moi.gov.tw/MoiOD/System/DownloadFile.aspx\?DATA\=CD02C824-45C5-48C8-B631-98B205A2E35A' | 198 | | xargs curl -O |
203 | alias data-taiwan-village='curl -o village.zip -L http://data.moi.gov.tw/MoiOD/System/DownloadFile.aspx\?DATA\=B8AF344F-B5C6-4642-AF46-1832054399CE' | 199 | } |
204 | alias data-taiwan-poly='curl -O http://download.geofabrik.de/asia/taiwan.poly' | 200 | alias data_taiwan_town='curl -o town.zip -L http://data.moi.gov.tw/MoiOD/System/DownloadFile.aspx\?DATA\=CD02C824-45C5-48C8-B631-98B205A2E35A' |
205 | alias data-taiwan-county-code='curl --silent https://www.ris.gov.tw/documents/data/5/1/RSCD0101.txt | iconv -f BIG-5 -t UTF-8 -' | 201 | alias data_taiwan_village='curl -o village.zip -L http://data.moi.gov.tw/MoiOD/System/DownloadFile.aspx\?DATA\=B8AF344F-B5C6-4642-AF46-1832054399CE' |
202 | alias data_taiwan_poly='curl -O http://download.geofabrik.de/asia/taiwan.poly' | ||
203 | alias data_taiwan_county_code='curl --silent https://www.ris.gov.tw/documents/data/5/1/RSCD0101.txt | iconv -f BIG-5 -t UTF-8 -' | ||
206 | 204 | ||
207 | # clipboard | 205 | # clipboard |
208 | alias xi='xsel -ib' | 206 | alias xi='xsel -ib' |
@@ -213,7 +211,7 @@ alias xc='xsel -ob | gcc -xc -' | |||
213 | 211 | ||
214 | # image | 212 | # image |
215 | image_vertical() { | 213 | image_vertical() { |
216 | convert $@ -append output.png | 214 | convert $@ -append output.png |
217 | } | 215 | } |
218 | 216 | ||
219 | # mail mutt | 217 | # mail mutt |
@@ -227,10 +225,10 @@ token() { | |||
227 | } | 225 | } |
228 | alias gr='_grepString' | 226 | alias gr='_grepString' |
229 | _grepString() { | 227 | _grepString() { |
230 | grep -R $1 . | 228 | grep -R $1 . |
231 | } | 229 | } |
232 | alias findn='find . -iname' | ||
233 | alias wcl='wc -l' | 230 | alias wcl='wc -l' |
231 | alias findn='find . -iname' | ||
234 | alias x='xdg-open' | 232 | alias x='xdg-open' |
235 | alias f='free -h' | 233 | alias f='free -h' |
236 | alias yl='youtube-dl' | 234 | alias yl='youtube-dl' |
@@ -243,10 +241,10 @@ alias mm='mkvmerge -o out.webm -w 01.webm + 02.webm' | |||
243 | alias du='ncdu' | 241 | alias du='ncdu' |
244 | alias we='weechat' | 242 | alias we='weechat' |
245 | mvt_decode() { | 243 | mvt_decode() { |
246 | python3 $SETTING_DIR/scripts/mvt_decode.py $1 | tr \' \" | sed 's/True/true/g' | jq . | 244 | python3 $SETTING_DIR/scripts/mvt_decode.py $1 | tr \' \" | sed 's/True/true/g' | jq . |
247 | } | 245 | } |
248 | big52utf8() { | 246 | big52utf8() { |
249 | iconv -f BIG-5 -t UTF-8 | 247 | iconv -f BIG-5 -t UTF-8 |
250 | } | 248 | } |
251 | 249 | ||
252 | # tmp | 250 | # tmp |