summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-02-05 20:48:23 +0800
committertypebrook <typebrook@gmail.com>2020-02-05 20:48:23 +0800
commit7cd2078840eafa8eebfd8eadde89015b73f15a63 (patch)
tree642754105e00e925d798e2cb1b9bdce9696eb8da
parentaa9ebaf1ab4b234a07de64f3965bdf74caaea6e6 (diff)
update
-rw-r--r--alias120
1 files changed, 59 insertions, 61 deletions
diff --git a/alias b/alias
index 343cea0..a9c9c9a 100644
--- a/alias
+++ b/alias
@@ -20,13 +20,13 @@ alias cdv='cd ~/.vim_runtime' # amix/vimrc repo
20 20
21# script 21# script
22vs() { 22vs() {
23 ( which $1 ) && vim $(which $1) 23 ( which $1 ) && vim $(which $1)
24} 24}
25todo() { 25todo() {
26 ( which $1 ) && grep -Po 'TODO.*' $(which $1) 26 ( which $1 ) && grep -Po 'TODO.*' $(which $1)
27} 27}
28fix() { 28fix() {
29 ( which $1 ) && grep -Po 'FIXME.*' $(which $1) 29 ( which $1 ) && grep -Po 'FIXME.*' $(which $1)
30} 30}
31cdgi() { 31cdgi() {
32 dir=$(gist $1 --no-action) 32 dir=$(gist $1 --no-action)
@@ -40,13 +40,13 @@ alias hg='history | grep'
40alias rmrf='rm -rf' 40alias rmrf='rm -rf'
41alias rr='move_to_tmp' 41alias rr='move_to_tmp'
42move_to_tmp() { 42move_to_tmp() {
43 mv $@ /tmp 43 mv $@ /tmp
44} 44}
45prompt() { 45prompt() {
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
60alias ..='cd ..' 60alias ..='cd ..'
61alias ld='cd -' # last directory 61alias ld='cd -' # last directory
62cdg() { 62cdg() {
63 cd ~/git/$1 || cd ~/git 63 cd ~/git/$1 || cd ~/git
64} 64}
65alias cda='cd ~/data' 65alias cda='cd ~/data'
66alias cdd='cd ~/Downloads' 66alias cdd='cd ~/Downloads'
@@ -82,12 +82,8 @@ alias chs='cd $SETTING_DIR && tig status' # check setting changes
82alias cdw='cd ~/vimwiki' 82alias cdw='cd ~/vimwiki'
83alias chw='cd ~/vimwiki && tig --all' 83alias chw='cd ~/vimwiki && tig --all'
84alias ww='cd ~/vimwiki && git add * && git commit -am "update" && git push' 84alias ww='cd ~/vimwiki && git add * && git commit -am "update" && git push'
85wg() { 85wg() { vim ~/vimwiki/$1.md }
86 vim ~/vimwiki/$1.md 86wi() { cat ~/vimwiki/$1.md }
87}
88wi() {
89 cat ~/vimwiki/$1.md
90}
91 87
92# crontab 88# crontab
93alias ce='crontab -e' 89alias ce='crontab -e'
@@ -96,13 +92,13 @@ alias ce='crontab -e'
96alias r='_ranger_cd' 92alias r='_ranger_cd'
97alias ranrc='vim ~/.config/ranger/rc.conf' 93alias 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
112unalias gc &> /dev/null # override zsh plugin alias 108unalias gc &> /dev/null # override zsh plugin alias
113gc() { 109gc() {
114 git clone $1 && cd $(basename $1) 110 git clone $1 && cd $(basename $1)
115} 111}
116gc1() { 112gc1() {
117 git clone --depth=1 $1 && cd $(basename $1) 113 git clone --depth=1 $1 && cd $(basename $1)
118} 114}
119gcg() { 115gcg() {
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}
122alias gls='git log -S' 118alias gls='git log -S'
123alias cdgw='cd .github/workflows' 119alias cdgw='cd .github/workflows'
124alias cdgs='cd $(git submodule status | sed "s/^.//" | cut -d" " -f2)' # cd to first submodule 120alias cdgs='cd $(git submodule status | sed "s/^.//" | cut -d" " -f2)' # cd to first submodule
125github_release_asset() { 121github_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'
150alias ta='tig --all' 146alias ta='tig --all'
151alias get-tig='curl -LO https://github.com/typebrook/tig/releases/download/tig-2.5.0/tig' 147alias get-tig='curl -LO https://github.com/typebrook/tig/releases/download/tig-2.5.0/tig'
152upload_tig() { 148upload_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
163alias debug='./gradlew app:installDebug && adb shell am start -n com.geothings.geobingan/.MainActivity_' 159alias debug='./gradlew app:installDebug && adb shell am start -n com.geothings.geobingan/.MainActivity_'
164alias adb-default='adb shell dumpsys package domain-preferred-apps' 160alias adb_default='adb shell dumpsys package domain-preferred-apps'
165alias adb-list='adb shell dumpsys package d' 161alias adb_list='adb shell dumpsys package d'
166alias rmcache='rm -rf ~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/*' 162alias rmcache='rm -rf ~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/*'
167alias adb-last-screenshot='adb pull /sdcard/Screenshots/`adb shell ls -t /sdcard/Screenshots/ | head -1` ~/Desktop' 163alias adb_last_screenshot='adb pull /sdcard/Screenshots/`adb shell ls -t /sdcard/Screenshots/ | head -1` ~/Desktop'
168adb_push() { 164adb_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'
182alias oias='ogrinfo -al -so' 178alias oias='ogrinfo -al -so'
183 179
184# sample file 180# sample file
185alias sample-gpx='curl -O https://docs.mapbox.com/help/data/run.gpx' 181alias sample_gpx='curl -O https://docs.mapbox.com/help/data/run.gpx'
186alias sample-geojson='curl -O https://docs.mapbox.com/help/data/stations.geojson' 182alias sample_geojson='curl -O https://docs.mapbox.com/help/data/stations.geojson'
187alias sample-geotiff='curl -O https://docs.mapbox.com/help/data/landsat.tif' 183alias sample_geotiff='curl -O https://docs.mapbox.com/help/data/landsat.tif'
188alias sample-csv='curl -O https://docs.mapbox.com/help/data/airports.csv' 184alias sample_csv='curl -O https://docs.mapbox.com/help/data/airports.csv'
189alias sample-svg='curl -O https://docs.mapbox.com/help/data/bicycle-24.svg' 185alias sample_svg='curl -O https://docs.mapbox.com/help/data/bicycle-24.svg'
190alias sample-mbtiles='curl -O https://docs.mapbox.com/help/data/trails.mbtiles' 186alias sample_mbtiles='curl -O https://docs.mapbox.com/help/data/trails.mbtiles'
191alias sample-kml='curl -O https://docs.mapbox.com/help/data/farmers_markets.kml' 187alias sample_kml='curl -O https://docs.mapbox.com/help/data/farmers_markets.kml'
192alias sample-osm='curl https://api.openstreetmap.org/api/0.6/node/3428095932' 188alias sample_osm='curl https://api.openstreetmap.org/api/0.6/node/3428095932'
193 189
194# data file 190# data file
195alias taiwan='curl -O http://download.geofabrik.de/asia/taiwan-latest.osm.pbf' 191alias taiwan='curl -O http://download.geofabrik.de/asia/taiwan-latest.osm.pbf'
196alias data-rudymap='curl -O https://raw.githubusercontent.com/alpha-rudy/taiwan-topo/master/styles/mapsforge_style/MOI_OSM.xml' 192alias data_rudymap='curl -O https://raw.githubusercontent.com/alpha-rudy/taiwan-topo/master/styles/mapsforge_style/MOI_OSM.xml'
197alias data-rudymap-ele='curl -O http://moi.kcwu.csie.org/osm_elevations/ele_taiwan_10_50_100_500_marker-2019.7.o5m' 193alias data_rudymap_ele='curl -O http://moi.kcwu.csie.org/osm_elevations/ele_taiwan_10_50_100_500_marker-2019.7.o5m'
198alias data-osm-diff="curl https://planet.openstreetmap.org/replication/minute/state.txt |\ 194data_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 \
202alias 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
203alias data-taiwan-village='curl -o village.zip -L http://data.moi.gov.tw/MoiOD/System/DownloadFile.aspx\?DATA\=B8AF344F-B5C6-4642-AF46-1832054399CE' 199}
204alias data-taiwan-poly='curl -O http://download.geofabrik.de/asia/taiwan.poly' 200alias data_taiwan_town='curl -o town.zip -L http://data.moi.gov.tw/MoiOD/System/DownloadFile.aspx\?DATA\=CD02C824-45C5-48C8-B631-98B205A2E35A'
205alias data-taiwan-county-code='curl --silent https://www.ris.gov.tw/documents/data/5/1/RSCD0101.txt | iconv -f BIG-5 -t UTF-8 -' 201alias data_taiwan_village='curl -o village.zip -L http://data.moi.gov.tw/MoiOD/System/DownloadFile.aspx\?DATA\=B8AF344F-B5C6-4642-AF46-1832054399CE'
202alias data_taiwan_poly='curl -O http://download.geofabrik.de/asia/taiwan.poly'
203alias 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
208alias xi='xsel -ib' 206alias xi='xsel -ib'
@@ -213,7 +211,7 @@ alias xc='xsel -ob | gcc -xc -'
213 211
214# image 212# image
215image_vertical() { 213image_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}
228alias gr='_grepString' 226alias gr='_grepString'
229_grepString() { 227_grepString() {
230 grep -R $1 . 228 grep -R $1 .
231} 229}
232alias findn='find . -iname'
233alias wcl='wc -l' 230alias wcl='wc -l'
231alias findn='find . -iname'
234alias x='xdg-open' 232alias x='xdg-open'
235alias f='free -h' 233alias f='free -h'
236alias yl='youtube-dl' 234alias yl='youtube-dl'
@@ -243,10 +241,10 @@ alias mm='mkvmerge -o out.webm -w 01.webm + 02.webm'
243alias du='ncdu' 241alias du='ncdu'
244alias we='weechat' 242alias we='weechat'
245mvt_decode() { 243mvt_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}
248big52utf8() { 246big52utf8() {
249 iconv -f BIG-5 -t UTF-8 247 iconv -f BIG-5 -t UTF-8
250} 248}
251 249
252# tmp 250# tmp