-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.alias
453 lines (365 loc) · 14.5 KB
/
.alias
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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
### START:ALIAS functions ###############################
project_open() {
PROJECTNAME=$1
isRUNNING=$(tmux list-sessions | grep $PROJECTNAME | cut -d : -f 1)
isMUXPROJECT=$(tmuxinator list | xargs -n 1 | grep $PROJECTNAME)
echo $isRUNNING
echo $isMUXPROJECT
# attach to an already open-project launched via tmuxinator,
# or if that fails, then launch a project with tmuxinator
# and if that also fails, show a list of available projects via tmuxinator
if [ "$isRUNNING" == $PROJECTNAME ]
then
tmux a -t $PROJECTNAME
elif [ "$isMUXPROJECT" == $PROJECTNAME ]
then
tmuxinator $PROJECTNAME
tmux a -t $PROJECTNAME
else
echo "Attach to these already-open projects:"
tmux list-sessions
echo; echo;
echo "... OR, newly-launch any of these projects:"
tmuxinator list
fi
return 0
}
### END:ALIAS functions ###############################
### START:ALIAS file-shortcuts ###############################
export SCRIPTHOME="$HOME/jdev/lcli"
export MAGICKSCRIPTS="$SCRIPTHOME/imagemagick/im-scripts"
### END:ALIAS file-shortcuts ###############################
########################################################
# dangerous shortcut -- uncomment when needed only
########################################################
# alias shred
# --- alias shred1='shred -n 1 -u -v'
# --- alias shred2='shred -n 2 -u -v'
# --- alias shred3='shred -n 3 -u -v'
########################################################
# reload terminal, tmux, vim, etc
########################################################
alias reload_term="source ~/.bash_profile"
alias reload_tmux="tmux source-file ~/.tmux.conf"
# this won't work within vim, but left here for
# future reference
alias reload_vim="source $MYVIMRC"
########################################################
# basic utility customization shortcuts
########################################################
# some more ls aliases
alias lln="ls -alonF"
alias lo="ls -aloF"
alias ll="ls -AlF"
alias lg="ls -og"
alias la="ls -A"
alias l="ls -CF"
alias cl="clear"
alias clog="clear && ls -AghloF"
# use lx for colored ls output
# 'cloxut' is base command for the rest
# sort-by 'type' in reverse order
alias cloxut='clear && echo "" && lx -alF --color=never -r -s type'
alias cloxu="cloxut --no-time"
alias cloxt="cloxut --no-user"
alias clox="cloxut --no-user --no-time"
# absolute minimal lx with only size and names
# - removed permissions columns from each 'clox*' above
alias clx="clox --no-permissions"
alias clxu="cloxu --no-permissions"
alias clxt="cloxt --no-permissions"
alias clxut="cloxut --no-permissions"
# use lx for colorized tree output
# 'cloxT' is base command for the rest
alias cloxT='clear && echo "" && lx -aT -I "*node_modules*"'
alias cloxT1="cloxT -L1"
alias cloxT2="cloxT -L2"
alias cloxT3="cloxT -L3"
alias cloxT4="cloxT -L4"
# alias for 'exa' - a modern 'ls' alternative
alias lx="exa"
# quickie-moves
alias cd..="cd .."
alias cd1="cd .."
alias cd2="cd ../.."
alias cd3="cd ../../.."
alias cd4="cd ../../../.."
alias cd5="cd ../../../../.."
alias godev="cd $PRJ"
alias godos="cd $dir_dodos"
alias godots="cd $dir_dotpath"
# quickie-moves
alias godevs="cd $PRJ"
alias gotabs="cd $dir_dashes"
alias gowork="cd $dir_work"
alias gopydev="cd $dir_py"
alias gorefs="cd $dir_refsbase"
alias gotrab="cd $dir_trab"
alias gotuts="cd $dir_tuts"
alias gohow="cd $dir_howto"
alias goviz="cd $dir_viz"
alias gosesh="cd $dir_sesh"
alias gonim="cd $dir_nim"
alias gofinc="cd $dir_finc"
alias goresume="cd $dir_resume"
alias gosessions="cd $dir_sessions"
# todo: maybe obsolete, these??
alias goschool="cd $SCHOOL"
alias gobooks="cd $BOOKS"
alias goweb="cd $MYWEB"
alias gogdrive="cd $HOME/GoogleDrive"
# my howto snippets and articles
alias h2="cd $dir_howto"
alias h2ls="h2; clx"
# memory
alias du1="du -hc -d 1"
alias sysmem1="du -hc -d 1"
alias sysmem2="du -hc -d 2"
# list project environment variables
alias lsdirs="cddots && rg -i DIR_"
########################################################
# git-related shortcuts
########################################################
# alias git
alias gita="git add"
alias gitb="git branch"
alias gitch="git checkout"
alias gitd="git diff"
alias gits="git status"
alias gitu="git reset --soft HEAD^"
# lsp GH tickets
alias hub_issues_open='hub issue -f "%sC%>(8)%i%Creset %t [%sC %as %Creset] %n" -l polymer'
alias hub_issues_closed='hub issue -f "%sC%>(8)%i%Creset %t [%sC %as %Creset] %n" -s closed -l polymer'
########################################################
# find/search shortcuts
########################################################
# make rip-grep search dotfiles (e.g. hidden files) by default
alias rg="rg -i --hidden"
# convenience rip-grep setups with pre-defined context setup
alias rg3="rg -i --hidden --context=3"
alias rg7="rg -i --hidden --context=5"
alias rg11="rg -i --hidden --context=11"
alias rg17="rg -i --hidden --context=17"
alias rg19="rg -i --hidden --context=19"
alias rg23="rg -i --hidden --context=23"
alias rg29="rg -i --hidden --context=29"
# find - to maxdepth N-levels
alias find1='find . -maxdepth 1 \( -not -path "*node_*" \) -iname'
alias find2='find . -maxdepth 2 \( -not -path "*node_*" \) -iname'
alias find3='find . -maxdepth 3 \( -not -path "*node_*" \) -iname'
alias find5='find . -maxdepth 5 \( -not -path "*node_*" \) -iname'
alias find7='find . -maxdepth 7 \( -not -path "*node_*" \) -iname'
alias find11='find . -maxdepth 11 \( -not -path "*node_*" \) -iname'
alias find21='find . -maxdepth 21 \( -not -path "*node_*" \) -iname'
########################################################
# vim and tmux shortcuts
########################################################
# alias tmux
alias tmux="tmux -2"
alias txp="tmuxp load"
alias txpls="ls -ogh ~/.tmuxp"
alias txn="tmux new-session -s"
alias txl="tmux list-sessions"
alias txa="tmux a -t"
alias txd="tmux detach"
alias temp_tmux="$HOME/tmp/temp_tmux"
alias txrw="tmux rename-window"
# alias tmuxp
alias xpld="tmuxp load"
alias xpls="ls -ogh ~/.tmuxp/"
# alias tmuxp "recently-active" sessions
# .. these sessions are created and destroyed based
# .. on most recent projects, etc I work on
alias txplsh="clx $dir_sesh/session-configs"
alias txpload="cd $dir_sesh/session-configs && tmuxp load"
alias txpstop="tmux kill-session -t"
alias txpedit="pushd . && cd $dir_sesh/session-configs && nim"
# alias vim
alias vtmux="vim ~/.tmux.conf"
alias vbash="vim ~/.bashrc"
alias vvim="vim ~/.vimrc"
alias nim=nvim
########################################################
# music player shortcuts
########################################################
# alias vlc commandline
alias vlc="/Applications/VLC.app/Contents/MacOS/VLC"
alias vlcd="/Applications/VLC.app/Contents/MacOS/VLC --intf dummy -Z"
alias vlcrc="/Applications/VLC.app/Contents/MacOS/VLC --intf rc -Z"
alias vlcnc="/Applications/VLC.app/Contents/MacOS/VLC --intf ncurses -Z"
# mpv player
alias mpv="/Applications/mpv.app/Contents/MacOS/mpv"
alias mpl="/Users/jose8a/jdev/l0/mpl/mpl"
########################################################
# browser shortcuts
########################################################
# google chrome
alias chrome="open -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
# opera browser
alias opera="open -a /Applications/Opera.app/Contents/MacOS/Opera"
# vivaldi browser
alias vivaldi="open -a /Applications/Vivaldi.app/Contents/MacOS/Vivaldi"
# firefox browser
alias brave="open -a /Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser"
alias fox="open -a /Applications/Firefox.app/Contents/MacOS/firefox"
alias firefox="open -a /Applications/Firefox.app/Contents/MacOS/firefox"
########################################################
# bash-scripts
########################################################
# tabset/browser-window launchers
alias ww="cd /Users/jose8a/jdev/l0/ww && ./ww.js"
# project launchers
alias op="/Users/jose8a/jdev/l0/op/op.js"
alias po="/Users/jose8a/jdev/l0/po/po"
alias pojs="/Users/jose8a/jdev/l0/po/src/po"
alias pyo="cd /Users/jose8a/jdev/l0/po/py/ && python po2.py"
alias pyo="python /Users/jose8a/jdev/l0/po/py/po2.py"
# timer-scripts
alias bsm="~/.bsm/bsm.sh"
alias btimer="$SCRIPTHOME/sh-utils/timer.sh"
alias blt=btimer
alias ytimer="blt -a yt"
# markdown bash scripts
alias llscripts="ll $SCRIPTHOME"
alias lsgroup="$SCRIPTHOME/mdown/ls-url-group.sh"
alias lstitles="$SCRIPTHOME/mdown/ls-md-titles.sh"
alias launchtabset="$SCRIPTHOME/mdown/launch-url-group.sh"
# link-checking utility
alias lkc="$SCRIPTHOME/link-checker/index.js"
########################################################
# image-related shortcuts
########################################################
# image utilities
alias imgls="~/bin/imgls"
alias imgcat="~/bin/imgcat"
# imagemagick scripts
alias img_blur="$MAGICKSCRIPTS/im-blur.sh"
alias img_charcoal1="$MAGICKSCRIPTS/im-charcoal1.sh"
alias img_charcoal2="$MAGICKSCRIPTS/im-charcoal2.sh"
alias img_greyscale="$MAGICKSCRIPTS/im-greyscale.sh"
alias img_histcontrast1="$MAGICKSCRIPTS/im-histcontrast1.sh"
alias img_histcontrast2="$MAGICKSCRIPTS/im-histcontrast2.sh"
alias img_outline1="$MAGICKSCRIPTS/im-outline1.sh"
alias img_outline2="$MAGICKSCRIPTS/im-outline2.sh"
alias img_outline3="$MAGICKSCRIPTS/im-outline3.sh"
alias img_pencil1="$MAGICKSCRIPTS/im-pencil1.sh"
alias img_pencil2="$MAGICKSCRIPTS/im-pencil2.sh"
alias img_sepia="$MAGICKSCRIPTS/im-sepia.sh"
########################################################
# misc shortcuts - 1
########################################################
# filter utilities for my markdownfiles
alias filterH0="grep -ne '# [^=]'"
alias filterH1="grep -ne '^# [^=]'"
alias filterH3="grep -ne '^### [^=]'"
alias filterH5="grep -ne '^##### [^=]'"
# html 'hq' tool/utility
alias hq="htmlq"
# json extract-utilities
alias jdeps="jq '.dependencies' < package.json"
alias jscripts="jq '.scripts' < package.json"
# show headings in a MD-type file
alias catheads='grep -e "\`.*\`\|^##"'
# if 'bat' exists, use it instead of 'cat'
# - 'bat' is a syntax-highlighting version of the 'cat' utility
if [ -x "$(command -v bat)" ]; then
alias cat='bat'
fi
# terminal output of a file, but syntax-highlight for code files
alias pycat='pygmentize -g -O'
alias pycate='pygmentize -g -O style=emacs' # emacs-style color theme
alias pycatn='pygmentize -g -O style=native' # native vim color theme
alias pycatf='pygmentize -g -O style=friendly' # vim pyte color theme
# diff'ing shortcuts
alias diffc='diff -y --color=always'
alias diffc_min='diff -y --color=always --suppress-common-lines'
alias diffyc="diff -y --color='always' --suppress-common-lines"
alias diffcc="diff --context=5 --color='always'"
### ########################################################
### # misc shortcuts - 2
### ########################################################
#alias cheatsheets
alias cheatgit="cat $CHEATS/git.md"
alias cheatmux="cat $CHEATS/tmux.md"
# tabset rename
# source: https://npm.taobao.org/package/iterm2-tab-set
alias ts="tabset --title"
# display running node localhost TCP servers
alias show_local_apps="lsof -P -i tcp | grep node"
# alias eslint
alias herelint="./node_modules/eslint/bin/eslint.js"
# yarn tool
alias yarn="yarn --silent"
# alias system dictionary
alias dictionary="cat /usr/share/dict/words"
alias dict="cat /usr/share/dict/words"
alias words="cat /usr/share/dict/words"
# rails
alias railsdb_reset='rake db:drop; rake db:create; rake db:migrate; rake db:seed'
##################################################
### FENCE
##################################################
# markdown-to-html conversion shortcut
alias md2html='find . -name "*.md" | while read i; do pandoc -f markdown -t html "$i" -o "${i%.*}.html"; done'
# job-screen-init
export JBSCREEN_DIR='/Users/jose8a/jdev/ljob/astro-traba/traba/traba-opps/inbox-templates'
alias jbscreen_init='cp $JBSCREEN_DIR/*'
alias jbs_init='jbscreen_init'
# misc
alias list_examples='find . -maxdepth 1 -type d \( -exec echo $file {} \; -false -o -exec ls {} \; \)'
alias ctags="`brew --prefix`/bin/ctags"
alias byeTunes="kill `ps aux | grep '\/MacOS/iTunes$' | tr -s ' ' | cut -d ' ' -f 2`"
########################################################
# vite shortcuts
########################################################
alias create_vite="yarn create @vitejs/app"
########################################################
# jupyter lab shortcut:
# - jupyter-lab stores temp files to auto-save notebooks while
# they are being worked on
# - this alias will allow us to automatically specify a
# folder of our choosing in which to store those auto-save
# folders/files rather than allowing the application to
# store them anywhere and litter our filesystem with
# those files if not controlled by us.
########################################################
export JP_LSP_VIRTUAL_DIR=/Users/jose8a/.jupyter/xx-virtual-lsp-docs
export JLAB_TEMP_FILES=/Users/jose8a/.jupyter/xx-temp-saves
alias jlab="jupyter lab --FileCheckpoints.checkpoint_dir=$JLAB_TEMP_FILES"
########################################################
# badgelist/knova shortcuts
########################################################
# knova-utils
export KPATH=~/jbdg/scripts
alias kservers='lsof -P -i tcp | grep -E "localhost|LISTEN"'
alias ks='kservers'
#alias kuptime='cd ~/jdocs/myDocs/dodos/dodos && sh lsp-uptime.sh'
#alias kup='cd ~/jbdg/scripts/lsp-uptime/kup && ./kup.js'
alias kuptime='sh $KPATH/lsp-uptime/lsp-uptime.sh'
alias kup='$KPATH/lsp-uptime/kup/kup.js'
alias kv='$KPATH/ktab/kv.js'
########################################################
# possible-outdated aliases
########################################################
# alias google-app-engine
alias gae_launcher='python /opt/google-appengine-wx-launcher-read-only/GoogleAppEngineLauncher.py'
alias gae_upload='/opt/google_appengine/appcfg.py update'
alias gae_startserver='/opt/google_appengine/dev_appserver.py'
########################################################
# remove aliases - 2
########################################################
# alias touchpad
# TODO: remove the next two lines since these are not detected
# .. on my current laptop
# alias touchpad_disable="xinput set-prop 15 "Device Enabled" 0"
# alias touchpad_enable="xinput set-prop 15 "Device Enabled" 1"