-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalias.sh
executable file
·324 lines (276 loc) · 8.07 KB
/
alias.sh
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# 39358083848620420
#aliases
#echo "aliases"
#echo $__dir
# dib-bot aliases
alias dflush="sudo rm -rf $__dir/result/* && sudo rm -rf $__dir/temp/*"
alias als="geany /home/zam/dib-asis/alias.sh"
alias main1="geany /home/zam/dib-asis/main.sh"
alias reinit="source ~/dib-asis/main.sh"
alias codeasis="code ~/dib-asis/"
#aliases
alias filez="cd /media/data3/binsrc/4linux/FileZilla3/bin && ./filezilla"
alias aptbersih="sudo apt-get clean"
alias p8="ping 8.8.8.8"
alias p1="ping 1.1.1.1"
alias telegram="/media/data1/bins/4linux/telegram/Telegram"
alias dibmanage="localc /media/data1/Documents/meschedule-g2.xlsx"
alias run-edu="~/run-edu"
alias hl10="history | tail -n 10"
# alias firebase="/media/data3/binsrc/4linux/firebase-tools-linux"
alias gp="git push"
alias gpu="git pull"
alias dcn="curl https://dict.cn/$1 | head -n 200 | tail -n 100"
alias gwp="grep -inr 'wip\|todo' . > ./dummy/_todo.md"
alias upp="upower -i /org/freedesktop/UPower/devices/battery_BAT0"
# dir aliases
__proj="/media/data1/project1"
__da_m1="/media/data1/"
__da_m2="/media/data2/"
__da_cx="/media/data1/confidential"
# override / make nickname sys binaries
# alias cps="/usr/bin/composer"
alias mysql="/opt/lampp/bin/mysql"
alias mysqldump="/opt/lampp/bin/mysqldump"
# alias php="/opt/lampp/bin/php"
alias python="python2.7"
alias py3="python3"
alias r="R"
alias rf="R -f "
alias rs="Rscript"
alias phuml="/media/data3/projects/opensource/real.phuml/src/app/phuml"
alias postman="cd /media/data1/bins/Postman && ./Postman"
alias phpunit="/opt/lampp/bin/phpunit"
alias ru3="rvm use 3.1.0"
alias firefox="/media/data3/firefox/firefox"
alias apktool="java -jar /media/data3/play/tools/apktool_2.3.4.jar"
alias dex2jar="/media/data3/play/tools/revxbinexp/dex2jar-2.0/d2j-dex2jar.sh"
alias cutter="/media/data3/play/tools/revxbinexp/Cutter-v1.12.0-x64.Linux.AppImage"
# alias composer="/usr/local/bin/composer"
# alias composer="php ~/dib-asis/lib/composer.phar"
# alias typora="/media/data1/bins/4linux/Typora-linux-x64/bin/Typora-linux-x64/Typora"
alias yed="java -jar /media/data3/binsrc/yEd-3.19.1.1/yed-3.19.1.1/yed.jar"
#jars
alias stman="/media/data1/project1/ssh-tunnel-manager/ssh-tunnel-manager.sh"
#sudo required
alias lamst="sudo /opt/lampp/lampp start"
alias lamrst="sudo /opt/lampp/lampp restart"
alias lamstop="sudo /opt/lampp/lampp stop"
#functions / oneliner
function random(){
tr -cd \"[:digit:]\" < /dev/urandom | head -c 16
}
function randint(){
echo $(($(random) % $1))
}
function fileline(){
cat $1 | head -n $2 | tail -n 1
}
function linerange(){
cat $1 | head -$2 | tail +$3
}
function getTodo(){
for i in $(find .) ; do echo $i; cat $i | grep -in "to do" ; done;
}
function getFuncs(){
for i in $(find .) ; do echo $i; cat $i | grep -in function ; done;
}
function getCiFuncs(){
for i in $(find .) ; do echo $i; cat $i | grep -in function | grep -i "controllers\|model"; done;
}
function getImplement(){
for i in $(find .) ; do echo $i; cat $i | grep -in implement ; done;
}
function gitgetchange(){
#cp to dummy then upload
git diff --name-only HEAD $1
}
function gitdummy(){
#cp to dummy then upload
for i in $(cat $1);do mkdir -p "dummy/`dirname $i`"; cp -v $i dummy/$i; done
}
# 4 master
function gsys(){
git checkout staging
git merge master
git push
git checkout master
}
function gdys(){
git checkout staging
git merge dev
git push
git checkout dev
}
# 4 main
function gsym(){
git checkout staging
git merge main
git push
git checkout main
}
# main to staging
# gmr main staging
# dev to main
# gmr dev main
function gmr(){
git checkout $2
git merge $1
git push
git checkout $1
}
# cmds bookmark file access n run
function xBook(){
cat -n $1
# echo -ne "input >"
echo
echo -e "input >"
read in1
cmd1=`cat $1 | head -n $in1 | tail -n 1`
echo $in1" - "$cmd1
# $(cat $1 | head -n $in1 | tail -n 1)
$cmd1
}
# function hcd(){
# }
function nmclis(){
nmcli device show wlp1s0
}
function baseStat(){
echo "================================================================"
logfile=$1
echo $logfile
echo "base log"
cat $logfile | wc
#return logfile
}
function findx(){
echo "for f in \$\(find); do baseStat $f;done"
}
function initConda(){
__conda_setup="$('/home/zam/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/zam/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/zam/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/zam/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
}
function initMconda(){
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/zam/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/zam/miniconda3/etc/profile.d/conda.sh" ]; then
. "/home/zam/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/home/zam/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
}
# https://prefetch.net/blog/2020/07/14/decoding-json-web-tokens-jwts-from-the-linux-command-line/
function jwtd() {
if [[ -x $(command -v jq) ]]; then
jq -R 'split(".") | .[0],.[1] | @base64d | fromjson' <<< "${1}"
echo "Signature: $(echo "${1}" | awk -F'.' '{print $3}')"
fi
}
tmx-killall(){
while true;do tmux kill-session;echo kill;sleep 1;done
}
# dg1 mail.sysindo.com
# dg1 sysindo.com
dg1(){
url=$1
dig a $url
dig mx $url
dig txt $url
}
git-sync-d1(){
git checkout dev
git merge prod
}
git-sync-p1(){
git checkout prod
git merge dev
}
alias sync-ci4="$__dir/lib/_sync-ci4.sh"
#initConda
__secret=$__dir"/secrets"
#bookmark
alias dcd="xBook $__secret/dirBm"
alias dcd2="xBook $__secret/dirBm2"
alias dvc="xBook $__secret/dirBmVc"
alias fee="xBook $__secret/_fee1"
alias ddo="xBook $__secret/ddo"
alias dev1="xBook $__secret/dev1"
alias dev2="xBook $__secret/dev2"
alias dev3="xBook $__secret/dev3"
alias dev4="xBook $__secret/dev4"
alias dev5="xBook $__secret/dev5"
alias dr="xBook $__secret/dr"
alias dev="dev1"
alias ai="xBook $__secret/ai"
alias tmx="xBook $__secret/scttmux"
alias adbs="xBook $__secret/adbs"
alias amix="xBook $__secret/amix"
# devops
# leet yoo
for i in $(seq 0 10);do
alias kb$i="xBook $__secret/kbs/kb$i"
done;
# alias kubectl="minikube kubectl --"
alias abx="xBook $__secret/abx"
alias bak="xBook $__secret/bak"
# utils
alias db="xBook $__secret/db"
alias ut1="xBook $__secret/ut1"
alias qq="xBook $__secret/ut1"
alias ccx="xBook $__secret/ccx"
alias aux="xBook $__secret/aux"
# toolbox
alias tb1="xBook $__secret/tb1"
alias game="xBook $__secret/play"
alias sev="xBook $__secret/sev"
alias sev2="xBook $__secret/sev2"
alias enc="xBook $__secret/secretenc"
alias kong="xBook $__secret/secretkongBm"
alias sdd="xBook $__secret/secretSnipBm1"
alias stat1="xBook $__secret/secretstatBm"
alias dib="xBook $__secret/secretDibBm"
alias codes="xBook $__secret/codes"
alias app="xBook $__secret/app"
alias medias="xBook $__secret/medias"
alias mapid="cat $__dir/lib/id"
alias wiki="/media/data1/confidential/codes/wiki/w1.py"
alias get-sv="$__lib/_get-sv.sh"
#alias stat1="baseStat"
alias tf1='python3 -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"'
alias tf2='python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices(\"GPU\"))"'
alias tdcd="xBook $__secret/tdir"
alias tdev="xBook $__secret/tdev"
alias tcodes="xBook $__secret/tcodes"
alias bsar="xBook $__secret/bmSar"
# mount dib veracrypt drives
alias mvc="/media/data1/project1/server-things/dib01/_enc/vc-select.sh"
#sec
alias rsactftool="python3 /media/data3/play/tools/RsaCtfTool/RsaCtfTool.py"
alias stegsolve="java -jar /media/data3/play/tools/stegsolve.jar"
#alias ida6="cd /media/data2/Program\ Files/IDA\ 6.6 && winefile"
alias ida6="cd /media/data2/IDA\ 6.6 && winefile"
alias drand="python -c \"import random;print(random.randint(1,100))\""
alias phpunit="./../../vendor/bin/phpunit"
alias sshkey="ssh-keygen"
alias installthemes="git clone https://github.com/Gogh-Co/Gogh.git gogh"
#set ssh client timout
#/etc/ssh/ssh_config and set directive ServerAliveInterval to a value like 100:
# other configs
#ServerAliveInterval 100