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.

501 lines
11 KiB

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