Dotfiles for my tiling window manager + terminal workflow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

481 lines
11 KiB

6 years ago
6 years ago
  1. # vim: fdm=marker ft=go-template.sh syntax=sh
  2. # system [[[
  3. # clear screen
  4. c "printf '\033c'"
  5. hst "history"
  6. ## nf "printf '\033c' && neofetch | lolcat"
  7. nf "printf '\033c' && neofetch"
  8. fi "fish"
  9. # reload urxvt
  10. ru "xrdb ~/.Xresources"
  11. # list file sizes in megabytes with depth 1
  12. duh "sudo du -d 1 -h --apparent-size | sort -hr"
  13. dum "sudo du -d 1 -m --apparent-size | sort -hr"
  14. m "man"
  15. tl "tldr"
  16. nvt "nvidia-settings --assign CurrentMetaMode='DVI-I-1: nvidia-auto-select +0+0 {ForceCompositionPipeline=On}, HDMI-0: nvidia-auto-select +3840+0 {ForceCompositionPipeline=On}'"
  17. {{ if eq .chezmoi.fullHostname "x1-carbon" }}
  18. xr "xrandr"
  19. xro "xrandr --output HDMI2 --off"
  20. xrr "xrandr --output HDMI2 --auto --right-of eDP1 --scale 1.33x1.33"
  21. xrm "xrandr --output HDMI2 --auto --same-as eDP1 --scale 1.33x1.33"
  22. xrs "xrandr -s 0"
  23. {{ end }}
  24. vgb "sudo nvim /etc/default/grub"
  25. mkgb "sudo grub-mkconfig -o /boot/grub/grub.cfg"
  26. b "bat"
  27. ba "bat *"
  28. grep "grep --color=auto -n"
  29. grr "grep -r"
  30. # pk "pkill -f"
  31. cld "colordiff -wy --suppress-common-lines"
  32. mkpk "makepkg -sri"
  33. ex "chmod +x"
  34. # systemctl [[[ #
  35. ctl "sudo systemctl"
  36. ctle "sudo systemctl enable"
  37. ctld "sudo systemctl disable"
  38. ctla "sudo systemctl start"
  39. ctls "sudo systemctl stop"
  40. ctlt "sudo systemctl status"
  41. ctltd "sudo systemctl status dhcpcd"
  42. ctlr "sudo systemctl restart"
  43. # ]]] systemctl #
  44. wm "sudo wifi-menu"
  45. # mounting [[[ #
  46. udm "udisksctl mount -b"
  47. udmb "udisksctl mount -b /dev/sdc2"
  48. udu "udisksctl unmount -b"
  49. udub "udisksctl unmount -b /dev/sdc2"
  50. # ]]] mounting #
  51. tc "touch"
  52. vdr "vidir --verbose"
  53. # directory-related [[[ #
  54. ls "lsd"
  55. l "lsd -a"
  56. ll "lsd -al"
  57. smv "sudo mv"
  58. f "cd"
  59. fz "fzf"
  60. fnd "find . -type f -name"
  61. rmr "rm -rf"
  62. rmd "rm ~/Downloads/*"
  63. rmw "rm ~/.local/share/nvim/swap/"
  64. md "mkdir -p"
  65. rsy "rsync -Pr"
  66. # list all (un)mounted drives
  67. lhd "sudo fdisk -l"
  68. # get disc space for mounted drives
  69. # ds "df -h | tee >(head -n 1) >(grep sd) >/dev/null"
  70. ds "df -h | head -n 1 && df -h | grep sd"
  71. chownw "sudo chown -R {{ .chezmoi.group }}:wheel"
  72. chwnm "sudo chown -R {{ .chezmoi.group }}:wheel /run/media/{{ .chezmoi.username }}"
  73. # cd into backup folder and show backup sizes
  74. nbu "cd /run/media/{{ .chezmoi.group }}/backup-hd/{{ .chezmoi.fullHostname }}/tar && lsd -l"
  75. # ]]] directory-related #
  76. # power options [[[ #
  77. s "systemctl suspend"
  78. so "xset dpms force off"
  79. sd "systemctl poweroff"
  80. rb "systemctl reboot"
  81. lo "i3-msg exit"
  82. x "xmodmap ~/.Xmodmap && xset r rate $XSET_DELAY $XSET_RATE"
  83. X "xmodmap ~/.Xmodmap && xset r rate $XSET_DELAY $XSET_RATE"
  84. {{ if eq .chezmoi.fullHostname "x1-carbon" }}
  85. xl "xmodmap ~/.Xmodmap-laptop && xset r rate $XSET_DELAY $XSET_RATE"
  86. XL "xmodmap ~/.Xmodmap-laptop && xset r rate $XSET_DELAY $XSET_RATE"
  87. {{ end }}
  88. # ]]] power options #
  89. # sound
  90. {{ if eq .chezmoi.fullHostname "nzxt" }}
  91. vlm "alsamixer -c 0"
  92. vlh "alsamixer -c 2"
  93. {{ else }}
  94. vlm "alsamixer -c 1"
  95. {{ end }}
  96. # apt [[[ #
  97. # apti "sudo apt install"
  98. # aptr "sudo apt remove"
  99. # aptu "sudo apt upgrade"
  100. # ]]] apt #
  101. {{ if eq .chezmoi.osRelease.id "arch" }}
  102. # pacman [[[ #
  103. # pc "sudo pacman -S"
  104. # pcq "sudo pacman -Qi"
  105. # pcr "sudo pacman -Rns"
  106. # pcud "sudo pacman -Sy"
  107. # pcug "sudo pacman -Syu"
  108. # xpc "pacman -Qqne > ~/{{ .chezmoi.os }}-config/txt/{{ .chezmoi.fullHostname }}-pkgs.txt && pacman -Qqme > ~/{{ .chezmoi.os }}-config/txt/{{ .chezmoi.fullHostname }}-aur.txt "
  109. # ]]] pacman #
  110. # tri "trizen -S --noconfirm"
  111. tri "trizen -S --noedit"
  112. # yay [[[ #
  113. # install
  114. ya "yay -S --answerclean=None --answerdiff=None --answeredit=None"
  115. # info
  116. yaq "yay -Qi"
  117. # remove
  118. yar "yay -Rns"
  119. # sync
  120. yaud "yay -Sy"
  121. # sync and download
  122. yadl "yay -Syuw --answerclean=None --answerdiff=None --answeredit=None"
  123. # sync and update
  124. yaug "yay -Syu --answerclean=None --answerdiff=None --answeredit=None"
  125. # export packages
  126. xya "yay -Qqne > ~/{{ .chezmoi.os }}-config/txt/{{ .chezmoi.fullHostname }}-pkgs.txt && yay -Qqme > ~/{{ .chezmoi.os }}-config/txt/{{ .chezmoi.fullHostname }}-aur.txt "
  127. # ]]] yay #
  128. {{ end }}
  129. py "python"
  130. pipi "sudo pip install"
  131. # internet
  132. pg "ping -c 3 -W 1 8.8.8.8"
  133. dh "sudo dhcpcd"
  134. kdh "sudo killall dhcpcd"
  135. rdh "sudo killall dhcpcd && sudo dhcpcd"
  136. id "identify"
  137. # rz "source ~/{{ .chezmoi.os }}-config/aliases/zsh_aliases"
  138. # mst "sudo rm ~/st/config.h && sudo bear make -C ~/st install"
  139. mst "sudo ~/st/make-st.sh"
  140. # system ]]]
  141. # applications [[[ #
  142. # silent="> /dev/null 2>&1& "
  143. chr "google-chrome"
  144. clc "cloc ."
  145. cv "cava"
  146. dg "dragon-drag-and-drop -x"
  147. fh "feh"
  148. gpd "gpg --decrypt"
  149. gpe "gpg --encrypt --recipient"
  150. htc "htop -s PERCENT_CPU"
  151. htm "htop -s PERCENT_MEM"
  152. i "sxiv"
  153. ig "sxiv -a"
  154. it "sxiv -t *"
  155. ka "killall"
  156. kd "killall Discord && killall Discord && killall slack"
  157. kt "killall thunderbird"
  158. mp "mpv --volume=50"
  159. mra "man ranger"
  160. n "nvim"
  161. p3 "python3"
  162. pdft "pdftotext"
  163. pipes "pipes.sh -t 3"
  164. py "python"
  165. r "ranger"
  166. rg "printf '\033c' && rg"
  167. rx "redshift -x"
  168. sn "sudo nvim"
  169. vmd "vimdiff"
  170. wg "wego"
  171. wp "grep wallpaper ~/.cache/wal/colors.sh"
  172. z "zathura --fork"
  173. lz "unzip -l"
  174. # pass [[[ #
  175. ps "pass"
  176. psc "pass -c"
  177. pse "pass edit"
  178. psi "pass insert -m"
  179. psg "pass generate -c"
  180. pss "pass show"
  181. xc "xclip -selection clipboard"
  182. yh "echo 'kevin.mok@live.ca' | xclip -selection clipboard"
  183. yg "xclip -selection clipboard ~/.password-store/social/gmail"
  184. yt "xclip -selection clipboard ~/.password-store/social/trapbot"
  185. yu "echo 'kevin.mok@mail.utoronto.ca' | xclip -selection clipboard"
  186. # ]]] pass #
  187. # watson [[[ #
  188. w "watson"
  189. wa "watson start"
  190. wae "watson start && watson edit"
  191. we "watson edit"
  192. wl "watson log --day"
  193. wla "watson log --all --tag="
  194. ww "watson log"
  195. # wlm "watson log --project coding --tag mfs"
  196. wr "watson report --day"
  197. wra "watson report --all"
  198. wrw "watson report"
  199. wre "watson restart"
  200. wree "watson restart && watson edit"
  201. ws "watson status && watson stop"
  202. wse "watson stop && watson edit"
  203. wsc "watson cancel"
  204. wsl "watson stop && watson log --day"
  205. wt "watson status"
  206. # ]]] watson #
  207. # ]]] applications #
  208. # git [[[ #
  209. g "git"
  210. gstr "git config credential.helper store"
  211. # branch [[[ #
  212. gb "git branch"
  213. gbd "git branch -D"
  214. gba "git branch --no-merged && echo '' && git branch --merged"
  215. gbu "git branch --no-merged"
  216. gbm "git branch --merged"
  217. gmg "git merge"
  218. gmgt "git mergetool"
  219. gr "git remote -v"
  220. gro "git remote show origin"
  221. # ]]] branch #
  222. # add/remove [[[ #
  223. ga "git add -A && git status -u"
  224. gac "git add -A && git commit -S"
  225. gaf "git add -f"
  226. # unsigned commt
  227. gacu "git add -A && git commit"
  228. grm "git rm"
  229. grmf "git rm -f"
  230. grmc "git rm --cached"
  231. grmfc "git rm -f --cached"
  232. grmor "rm (fd -e orig --no-ignore -H)"
  233. # ]]] add/remove #
  234. # diff/log [[[ #
  235. gd "git difftool -w --tool=vimdiff"
  236. gdc "git difftool -w --cached --tool=vimdiff"
  237. gdl "git diff -w"
  238. gdlc "git diff --cached -w"
  239. gdh "git diff --cached -w HEAD~1"
  240. gds "git diff --stat"
  241. gl "git log"
  242. glm "git log master"
  243. gsl "git shortlog"
  244. # ]]] diff/log #
  245. # pull [[[ #
  246. gcln "git clone"
  247. gs "git status -u"
  248. gf "git fetch origin"
  249. gcho "git checkout"
  250. gchon "git checkout -b"
  251. gchom "git checkout master"
  252. gchnw "git checkout -b wip"
  253. gchw "git checkout wip"
  254. grom "git reset --hard origin/master"
  255. gheadm1 "git reset --hard HEAD~1"
  256. # show files in git repo
  257. # gls "git ls-tree -r HEAD --name-only"
  258. gls "git ls-tree HEAD --name-only"
  259. gchp "git cherry-pick"
  260. gchpc "git cherry-pick --continue"
  261. gst "git stash"
  262. gstl "git stash list"
  263. gstp "git stash pop"
  264. gsts "git stash show stash@\{0\} -p"
  265. gclear "git stash clear"
  266. gpl "git pull --rebase"
  267. grba "git rebase --abort"
  268. grbc "git rebase --continue"
  269. # ]]] pull #
  270. # push [[[ #
  271. gc "git commit -S"
  272. gcu "git commit"
  273. gca "git add -A && git commit --amend --no-edit -S"
  274. gcam "git add -A && git commit --amend -S"
  275. # gcamp "git add -A && git commit --amend --no-edit -S && gpsf"
  276. psgi "git add -A && git commit -m 'Update' -S && git push"
  277. gps "git push"
  278. gpsi "git config credential.helper store && git push"
  279. # gpsn "git push --set-upstream origin master"
  280. gpsn "eval (git push 2>&1 | tail -n 2)"
  281. gpsf "git push --force"
  282. # assume file unchanged
  283. gunc "git update-index --assume-unchanged"
  284. # ]]] push #
  285. # ]]] git #
  286. # coding projs [[[ #
  287. rgt "rg TODO"
  288. # chezmoi [[[ #
  289. zm "chezmoi"
  290. za "chezmoi add"
  291. zar "chezmoi add -r"
  292. zd "chezmoi data"
  293. zdf "chezmoi diff"
  294. zp "chezmoi -v apply"
  295. # ]]] chezmoi #
  296. # spotify-lib-vis [[[ #
  297. # start spv server outside dir
  298. ssv "source ../bin/activate.fish && python manage.py runserver"
  299. # open spv db in psql
  300. spvdb "psql -d spotifyvis -U django"
  301. mig "python manage.py makemigrations && python manage.py migrate --run-syncdb && ssv"
  302. cldb "python manage.py flush --no-input && ssv"
  303. # django shell
  304. djs "python manage.py shell"
  305. # update pip
  306. upip "pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U"
  307. # update pip req's.
  308. ureq "pip freeze > requirements.txt"
  309. # show last history scan
  310. hlg "cat $spv_dir/src/api/management/commands/update-history.log | tail -n 1"
  311. # scan history
  312. # hs "$spv_dir/src/update-history.sh && cat $spv_dir/src/api/management/commands/update-history.log | tail -n 1"
  313. # scan cron log for hs cmd
  314. crnl "grep \"({{ .chezmoi.group }}) CMD\" /var/log/syslog | tail -n 1 && hlg"
  315. # removes all but newest file
  316. # rmol "ls -t | tail -n +2 | xargs rm -- && l"
  317. snw "spotify-now -i '%artist - %title'"
  318. # ]]] spotify-lib-vis #
  319. shc "shellcheck"
  320. pdl "pdflatex"
  321. tcl "tex-clean"
  322. # mfs [[[ #
  323. mfs "nvim ~/coding/best-mf-site-personal/index.html"
  324. ht "python3 -m http.server"
  325. # j "jekyll"
  326. # js "jekyll serve"
  327. h "hugo"
  328. he "hugo serve -D --disableFastRender"
  329. ss "ssh {{ .chezmoi.group }}@192.168.0.100"
  330. ssb "ssh-bandit"
  331. rt "python ~/coding/rt-scraper/!rt-scraper.py"
  332. # ]]] mfs #
  333. mm "printf '\033c' && bear make clean move_mouse_with_head && ./move_mouse_with_head"
  334. med "printf '\033c' && bear make clean eye_detector && ./eye_detector"
  335. mft "printf '\033c' && bear make clean face_detector && ./face_detector"
  336. rft "~/coding/face-tracker/face_detector > /tmp/move_mouse_with_head.out"
  337. gpsb "git push bitbucket"
  338. # ]]] coding projs #
  339. # school [[[ #
  340. # 369 [[[ #
  341. wlf "watson log --all --tag=final"
  342. wrf "watson report --all --tag=final"
  343. ssc "ssh mokkar@teach.cs.utoronto.ca"
  344. ma "printf '\033c' && bear make"
  345. mc "bear make clean"
  346. mca "bear make clean && printf '\033c' && bear make"
  347. rmc "rm compile_commands.json"
  348. rms "rm swapfile.*"
  349. # ]]] 369 #
  350. # 309 [[[ #
  351. wl0 "watson log --all --project=309 --tag=phase2"
  352. wr0 "watson report --all --project=309 --tag=phase2"
  353. # server [[[ #
  354. nd "node"
  355. ndm "nodemon"
  356. knd "killall node"
  357. mg "mongo"
  358. 0ht "cd ~/school/309-proj && python3 -m http.server"
  359. mgd "mongod --dbpath mongo-data"
  360. # nds "killall node && nodemon server.js"
  361. nds "nodemon server.js"
  362. # ]]] server #
  363. # heroku [[[ #
  364. hr "heroku"
  365. hrs "heroku local web"
  366. hrt "heroku ps"
  367. hrl "heroku logs --dyno web -n 1500 | rg up | awk '{ system(\"date -d \" \$1); \$1 = \"\"; print \$0 }' | paste -s -d' \n'"
  368. gpsh "git push heroku"
  369. 0c "node collections.js"
  370. # ]]] heroku #
  371. # ]]] 309 #
  372. jc "javac -d out *.java"
  373. jr "java -cp \"$CLASSPATH:out\""
  374. # ]]] school #