blob: 9add646f1b4146f66b9aa4ced7b68e33227aa9b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
SETTING_DIR="$HOME/git/settings"
# settings
alias al='vim ~/.bash_aliases && source ~/.bash_aliases'
alias all='source ~/.bash_aliases'
alias bashrc='vim ~/.bashrc'
alias zshrc='vim ~/.zshrc'
alias vimrc='vim ~/.vimrc'
alias tigrc='vim $SETTING_DIR/tigrc'
alias gitconfig='vim ~/.gitconfig'
alias log='cat log | grep "`date +"%b %d"`"'
# vim
alias v='vim'
alias vv='vim ~/vimwiki/index.wiki'
alias vr='vim -R'
alias cdv='cd ~/.vim_runtime' # amix/vimrc repo
# shell
alias ll='ls -alh'
alias ai='sudo apt install'
alias si='sudo snap install'
alias ss='sudo !!'
alias hg='history|grep'
alias rr='move_to_tmp'
move_to_tmp() {
mv $1 /tmp
}
# cd to DIRs
alias ..='cd ..'
alias ld='cd -' # last directory
alias cdg='cd ~/git'
alias cdd='cd ~/Downloads'
alias cdD='cd ~/Documents'
alias cdV='cd ~/Videos'
alias cdP='cd ~/Pictures'
# about custom settings
alias cds='cd $SETTING_DIR'
alias cdss='cd $SETTING_DIR/scripts'
alias chs='cd $SETTING_DIR && tig status' # check setting changes
# about vimwiki
alias chw='cd ~/vimwiki && tig'
alias ww='cd ~/vimwiki && git add * && git commit -am "update" && git push'
# crontab
alias ce='crontab -e'
# ranger
alias r='_ranger-cd'
alias ranrc='vim ~/.config/ranger/rc.conf'
_ranger-cd() {
tempfile="$(mktemp -t tmp.XXXXXX)"
ranger --choosedir="$tempfile" "${@:-$(pwd)}"
test -f "$tempfile" &&
if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
cd -- "$(cat "$tempfile")"
fi
rm -f -- "$tempfile"
}
# disk
alias df='df -h'
# git
alias g='git'
alias gc='git clone'
alias gc1='git clone --depth=1'
alias gls='git log -S'
alias cdgs='cd `git submodule status | sed 's/^.//' | cut -d" " -f2`' # cd to first submodule
# docker
alias dp='docker ps'
alias dpa='docker ps -a'
alias di='docker images'
alias dc='docker-compose run --rm'
alias dstop='docker stop'
alias ds='docker stop'
alias drm='docker rm'
# ssh
alias keygen='ssh-keygen -t rsa -C "typebrook@gmail.com"'
alias topo='ssh typebrook@topo.tw'
alias ptt='ssh bbsu@ptt.cc'
alias geothings='ssh geothings@geobingan.info'
alias geothings-test='ssh geothings@test.geothings.tw'
# tig
alias cdt='cd ~/git/tig'
alias t='tig'
alias ts='tig status'
alias ta='tig --all'
alias get-tig='curl -LO https://github.com/typebrook/tig/releases/download/tig-2.4.1/tig'
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)'
# Android
alias debug='./gradlew app:installDebug && adb shell am start -n com.geothings.geobingan/.MainActivity_'
alias adb-default='adb shell dumpsys package domain-preferred-apps'
alias adb-list='adb shell dumpsys package d'
alias rmcache='rm -rf ~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/*'
alias adb-last-screenshot='adb pull /sdcard/Screenshots/`adb shell ls -t /sdcard/Screenshots/ | head -1` ~/Desktop'
alias adb-push='adb push /sdcard/Download/'
# gist
gist_list=~/gist/gist.list
alias gl='nl $gist_list'
alias gll='gist -l > $gist_list && nl $gist_list'
alias gi='_gistRead'
alias gd='_gistDelete'
_gistRead() {
gist -r $(awk '{print $1}' $gist_list | awk -v row="$1" -F '/' 'FNR==row {print $NF}') $2
}
_gistDelete() {
deleted=~/gist/deleted/$(date +"%s")
_gistRead $1 > $deleted && echo "backup at $deleted"
gist --delete $(awk '{print $1}' $gist_list | awk -v row="$1" -F '/' 'FNR==row {print $NF}') && \
gll
}
alias note='gist -r 5dd936e91d9ae75ad77084da762f5c11 note > ~/gist/note && \
vim ~/gist/note && \
gist -u 5dd936e91d9ae75ad77084da762f5c11 ~/gist/note'
alias todo='gist -r 5dd936e91d9ae75ad77084da762f5c11 todo > ~/gist/todo && \
vim ~/gist/todo && \
gist -u 5dd936e91d9ae75ad77084da762f5c11 ~/gist/todo'
# curl
alias co='curl -O'
alias taiwan='curl -O http://download.geofabrik.de/asia/taiwan-latest.osm.pbf'
# python
alias pip3='python3 -m pip'
# gdal
alias oo='ogrinfo'
# sample file
alias sample-gpx='curl -O https://docs.mapbox.com/help/data/run.gpx'
alias sample-geojson='curl -O https://docs.mapbox.com/help/data/stations.geojson'
# xsel
alias xi='xsel -ib'
# misc
alias gr='_grepString'
_grepString() {
grep -R $1 .
}
alias findn='find . -iname'
alias wcl='wc -l'
alias x='xdg-open'
alias f='free -h'
alias yl='youtube-dl'
alias yla='youtube-dl -x --audio-format mp3'
alias raw='echo "https://raw.githubusercontent.com"'
alias editor='select-editor'
alias hp='http-prompt'
alias clocg='cloc --vcs=git'
alias tma='tmux a'
alias mm='mkvmerge -o out.webm -w 01.webm + 02.webm'
alias we='weechat'
mvt_decode() {
python3 $SETTING_DIR/scripts/mvt_decode.py $1 | tr \' \" | sed 's/True/true/g' | jq .
}
big52utf8() {
iconv -f BIG-5 -t UTF-8 $1 > $1.utf8
}
# tmp
alias cdo='cd ~/git/openmaptiles'
alias cdoo='cd ~/git/openmaptiles/styles/outdoor'
alias cdS='cd ~/git/StreetComplete'
alias cdW='cd ~/git/geoBingAnWeb'
alias and='cd ~/git/geoBingAn.Android'
alias cdG='cd ~/git/git'
repo='git@github.com'
hub='https://github.com'
typebrook='git@github.com:typebrook'
|