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.

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