# vim: fdm=marker ft=go-template.sh syntax=sh # system [[[ # basic [[[ # # clear screen c "printf '\033c'" d "cd ~/Downloads && printf '\033c'" hst "history" nft "printf '\033c' && neofetch | lolcat" # nft "printf '\033c' && neofetch" fi "fish" # reload urxvt ru "xrdb ~/.Xresources && grep wallpaper ~/.cache/wal/colors.sh | cut -d\' -f2 | xargs wal -i > /dev/null" dua "sudo du -h --apparent-size | sort -h" # list file sizes in megabytes with depth 1 # duh "sudo du -d 1 -h --apparent-size | sort -h" # dum "sudo du -d 1 -m --apparent-size | sort -h" duh "du -d 1 -h --apparent-size | sort -h" dum "du -d 1 -m --apparent-size | sort -h" # m "man" tld "tldr" # ]]] basic # # display [[[ # # nvt "nvidia-settings --assign CurrentMetaMode='DVI-I-1: nvidia-auto-select +0+0 {ForceCompositionPipeline=On}, HDMI-0: nvidia-auto-select +3840+0 {ForceCompositionPipeline=On}'" {{ if eq .chezmoi.fullHostname "x1-carbon" }} xr "xrandr" xro "xrandr --output HDMI2 --off" xrr "xrandr --output HDMI2 --auto --right-of eDP1 --scale 1.33x1.33" xrm "xrandr --output HDMI2 --auto --same-as eDP1 --scale 1.33x1.33" xrs "xrandr -s 0" {{ end }} # ]]] display # ngb "sudo nvim /etc/default/grub" mkgb "sudo grub-mkconfig -o /boot/grub/grub.cfg" a "bat" # ba "bat *" grep "grep --color=auto -n" grpr "grep -r" # pk "pkill -f" cld "colordiff -wy --suppress-common-lines" mkpk "makepkg -sri" ex "chmod +x" lns "ln -s" # systemctl [[[ # ct "sudo systemctl" cte "sudo systemctl enable" ctd "sudo systemctl daemon-reload" ctdi "sudo systemctl disable" cta "sudo systemctl start" cts "sudo systemctl stop" ctt "sudo systemctl status" # ctr "sudo systemctl restart" ctltd "sudo systemctl status dhcpcd" ctlas "sudo systemctl start sshd" nct "sudo netctl" nctf "sudo ip link set dev wlp3s0 down" nctr "sudo systemctl restart netctl-auto@wlp4s0.service" # ]]] systemctl # # ssh [[[ # cpssh "ssh-copy-id -i ~/.ssh/id_rsa.pub" xcssh "bat ~/.ssh/id_rsa.pub | xclip -selection clipboard" sp "mosh --ssh='ssh -p 8022' 192.168.0.12" ssd "mosh kevin@165.22.239.234 tmux a" sdh "mosh kevin@165.22.239.234 htop" # test server sites svp "firefox git.ataraxy.tk khkm.tk cal.khkm.tk pste.gq smol.gq twem.tk" # postgres ssh tunnel sdt "ssh kevin@165.22.239.234 -L 5433:localhost:5432" # ]]] ssh # wh "watch" ct "crontab" cte "crontab -e" wm "sudo wifi-menu" # mounting [[[ # udm "udisksctl mount -b" udmb "udisksctl mount -b /dev/sdc2" udu "udisksctl unmount -b" udub "udisksctl unmount -b /dev/sdc2" # ]]] mounting # tc "touch" vdr "vidir --verbose" # directory-related [[[ # {{ if not (eq .linux_os "termux") }} l "lsd -F --group-dirs first" la "lsd -AF --group-dirs first" ll "lsd -lF --group-dirs first --size short" lla "lsd -AlF --group-dirs first --size short" {{ else }} l "ls" la "ls -a" ll "ls -l" lla "ls -al" {{ end }} cwd "echo (pwd) | xclip -selection clipboard" smv "sudo mv" f "cd" fz "fzf -e" fbg "cd ~/Pictures/Backgrounds && ranger --selectfile (fzf -e --delimiter '/' --with-nth -1)" fnd "find . -type f -name" rmr "rm -rf" rmd "rm ~/Downloads/*" rmw "rm ~/.local/share/nvim/swap/" md "mkdir -p" rsy "rsync -Pr" # list all (un)mounted drives lhd "sudo fdisk -l" # get disc space for mounted drives # ds "df -h | tee >(head -n 1) >(grep sd) >/dev/null" ds "df -h | head -n 1 && df -h | grep sd" chownw "sudo chown -R kevin:wheel" chwnm "sudo chown -R kevin:wheel /run/media/{{ .chezmoi.username }}" # cd into backup folder and show backup sizes nbu "cd /run/media/kevin/backup-hd/{{ .chezmoi.fullHostname }}/tar && lsd -l" # ]]] directory-related # # power options [[[ # s "systemctl suspend" x "exit" so "xset dpms force off" sd "tmux kill-server; systemctl poweroff" rb "systemctl reboot" lo "i3-msg exit" xm "xmodmap ~/.Xmodmap && xset r rate $XSET_DELAY $XSET_RATE" X "xmodmap ~/.Xmodmap && xset r rate $XSET_DELAY $XSET_RATE" {{ if eq .chezmoi.fullHostname "x1-carbon" }} xl "xmodmap ~/.Xmodmap-laptop && xset r rate $XSET_DELAY $XSET_RATE" XL "xmodmap ~/.Xmodmap-laptop && xset r rate $XSET_DELAY $XSET_RATE" bt "~/linux-config/dot_config/i3blocks/scripts/executable_battery" {{ end }} # ]]] power options # # sound [[[ # {{ if eq .chezmoi.fullHostname "nzxt" }} vlm "alsamixer -c 0" vlh "alsamixer -c 2" {{ else }} vlm "alsamixer -c 1" {{ end }} # ]]] sound # # pkg management [[[ # {{ if eq .linux_os "arch" }}#[[[ # pacman [[[ # # pc "sudo pacman -S" # pcq "sudo pacman -Qi" # pcr "sudo pacman -Rns" # pcud "sudo pacman -Sy" # pcug "sudo pacman -Syu" # xpc "pacman -Qqne > ~/{{ .chezmoi.os }}-config/txt/{{ .chezmoi.fullHostname }}-pkgs.txt && pacman -Qqme > ~/{{ .chezmoi.os }}-config/txt/{{ .chezmoi.fullHostname }}-aur.txt " # ]]] pacman # # tri "trizen -S --noconfirm" tri "trizen -S --noedit" # yay [[[ # # install ya "yay -S --answerclean=None --answerdiff=None --answeredit=None" # info yaq "yay -Qi" # list files yal "yay -Ql" # remove yar "yay -Rns" # search yas "yay -Qs" # sync yau "yay -Sy" # sync and download yadl "yay -Syuw --answerclean=None --answerdiff=None --answeredit=None" # sync and update yaug "yay -Syu --answerclean=None --answerdiff=None --answeredit=None" # ]]] yay # #]]] {{ else if eq .linux_os "termux" }}#[[[ pki "pkg install" pkli "pkg list-installed" pku "pkg uninstall" pks "pkg search" xpk "pkg list-installed | awk -F/ '{print \$1}' > ~/{{ .chezmoi.os }}-config/txt/termux-pkgs.txt" {{ end }}#]]] # apt [[[ # {{ if and (eq .chezmoi.username "root") (eq .linux_os "debian") }} ap "apt install" apr "apt remove" apu "apt upgrade" {{ end }} # ]]] apt # # ]]] pkg management # # python [[[ # py "python" # pyt "printf '\033c' && pytest -vvs" pyt "clear && tmux clear-history && pytest -vvs" pyts "clear && tmux clear-history && pytest -vv" pyu "python -m unittest" pipi "pip install --user" spipi "sudo pip install" # ]]] python # # internet [[[ # pg "ping -c 2 -W 1 8.8.8.8" pgc "ping 8.8.8.8" dh "sudo dhcpcd" kdh "sudo killall dhcpcd" rdh "sudo killall dhcpcd && sudo dhcpcd" wgt "wget" {{ if and (eq .chezmoi.username "root") (eq .linux_os "debian") }} nt "nginx -t" {{ end }} # ]]] internet # fl "file" id "identify" # rz "source ~/{{ .chezmoi.os }}-config/aliases/zsh_aliases" mst "sudo rm ~/st/config.h && sudo bear make -C ~/st install" # mst "sudo ~/st/make-st.sh" # system ]]] # applications [[[ # # silent="> /dev/null 2>&1& " am "antimicro" # buku [[[ # # b "buku" bd "buku -za '" bdb "sqlitebrowser ~/.local/share/buku/bookmarks.db &" bh "buku -h | bat" bi "buku --immutable 1 -zu" bo "buku -o" bp "buku -p" br "buku -zd" brp "buku --replace" bs "buku --deep -n5 -s" bsq "sqlitebrowser ~/.local/share/buku/bookmarks.db &" bsv "bukuserver run --host 127.0.0.1 --port 5001" bt "buku --deep -n5 -t" bu "buku -zu" but "buku -zu --tag" bw "buku --immutable 1 -zw -1" # ]]] buku # cc "calcurse" ccc "calcurse -D ~/.calcurse/alt-cals/class" ccs "calcurse-caldav" chr "google-chrome" clc "cloc ." cv "cava" dg "dragon-drag-and-drop -x" ffx "firefox" fh "feh" fi "fish" gpd "gpg --decrypt" gpe "gpg --encrypt --recipient" hba "habitctl ask" hbl "habitctl log" htc "htop -s PERCENT_CPU" htm "htop -s PERCENT_MEM" i "sxiv" ia "sxiv -a" it "sxiv -t *" ki "kill -9" ka "killall" kd "killall Discord && killall Discord" kr "killall electron" kt "killall thunderbird" mp "mpv --volume=50" mra "man ranger" # mt "minetest" n "nvim" ndu "ncdu" p3 "python3" pdft "pdftotext" pipes "pipes.sh -t 3" py "python" qc "qalc '" qcg "qalculate-gtk" r "ranger" rbg "ranger --selectfile (grep wallpaper ~/.cache/wal/colors.sh | cut -d\' -f2)" # rgc "printf '\033c' && rg" # rgc "printf '\033c' && rg" rgc "clear && tmux clear-history && rg" rx "redshift -x" sn "sudo nvim" ss "mosh" stp "termdown" # sw "swex" t "tmux"#[[[ ta "tmux a -t" tac "tmux a -t config || tmux new -s config" taj "tmux a -t journal || tmux new -s journal" tal "tmux a" tk "tmux kill-server" tl "tmux ls" tn "tmux new -s" tnb "tmux new -s backup" #]]] usn "usernames --num 20" vmd "vimdiff" wg "wego" ytd "youtube-dl" z "zathura --fork" lz "unzip -l" # pass [[[ # ps "pass" psc "pass -c" pse "pass edit" psi "pass insert -m" psg "pass generate -c" pss "pass show" xc "xclip -selection clipboard" yh "echo 'kevin.mok@live.ca' | xclip -selection clipboard" yg "xclip -selection clipboard ~/.password-store/social/gmail" yt "xclip -selection clipboard ~/.password-store/social/trapbot" yu "echo 'kevin.mok@mail.utoronto.ca' | xclip -selection clipboard" # ]]] pass # # watson [[[ # w "watson" # start [[[ # wa "watson start" wae "watson start && watson edit" wad "watson add -f '' -t ''" we "watson edit" wre "watson restart" wree "watson restart && watson edit" # ]]] start # # stop [[[ # ws "watson status && watson stop" wse "watson stop && watson edit" wsc "watson cancel" wsl "watson stop && watson log --day" wt "watson status" # ]]] stop # # log/report [[[ # wl "watson log -Gcd" wla "watson log -Gca -p" wlat "watson log -Gca -T" ww "watson log -Gc" wr "watson report -Gcd" wra "watson report -Gca -p" wrat "watson report -Gca -T" wrw "watson report -Gc" # ]]] log/report # # ]]] watson # # ]]] applications # # git [[[ # g "git" gi "git init" gib "git init --bare" gstr "git config credential.helper store" gstrp "git config credential.helper store && git push" # branch [[[ # gb "git branch" gbd "git branch -D" gba "git branch --no-merged && echo '' && git branch --merged" gbu "git branch --no-merged" gbm "git branch --merged" gsm "git submodule add" gsmp "git submodule foreach git pull" gmg "git merge" gmgt "git mergetool" gr "git remote -v" gra "git remote add origin" grag "git remote add gitea git@ataraxy.tk:Kevin-Mok/.git" grr "git remote remove origin" grs "git remote show origin" gru "git branch --set-upstream-to=origin/master master" # ]]] branch # # add/remove [[[ # ga "git add -A && git status -u" gac "git add -A && git commit -S" gaf "git add -f" # unsigned commt gacu "git add -A && git commit" grm "git rm" grmf "git rm -f" grmc "git rm --cached" grmfc "git rm -f --cached" grmor "rm (fd -e orig --no-ignore -H)" # ]]] add/remove # # diff/log [[[ # gd "git diff -w" gdc "git diff --cached -w" gdh "git diff --cached -w HEAD~1" gds "git diff --stat" gdt "git difftool -w --tool=vimdiff" gdtc "git difftool -w --cached --tool=vimdiff" gl "git log" glm "git log master" gsl "git shortlog" # ]]] diff/log # # pull [[[ # gcln "git clone" gs "git status -u" gf "git fetch origin" gfg "git fetch gitea" gch "git checkout" gchn "git checkout -b" gchm "git checkout master" gchnw "git checkout -b wip" gchw "git checkout wip" gchfh "git checkout HEAD --" grom "git reset --hard origin/master" gheadm1 "git reset --hard HEAD~1" # show files in git repo # gls "git ls-tree -r HEAD --name-only" gls "git ls-tree HEAD --name-only" gchp "git cherry-pick" gchpc "git cherry-pick --continue" gst "git stash" gstl "git stash list" gstp "git stash pop" gsts "git stash show stash@\{0\} -p" gclear "git stash clear" gpl "git pull --rebase" grb "git rebase -i" grba "git rebase --abort" grbc "git rebase --continue" # ]]] pull # # push [[[ # gc "git commit -S" gcu "git commit" gca "git add -A && git commit --amend --no-edit -S" gcam "git add -A && git commit --amend -S" gcap "git add -A && git commit --amend --no-edit -S && git push --force" psgi "git add -A && git commit -m 'Update' -S && git push" gps "git push" gpsg "git push gitea" gpsi "git config credential.helper store && git push" # gpsn "git push --set-upstream origin master" gpsn "eval (git push 2>&1 | tail -n 2)" gpsf "git push --force" # assume file unchanged gunc "git update-index --assume-unchanged" # ]]] push # # ]]] git # # coding projs [[[ # rgt "rg TODO" # make [[[ # ma "printf '\033c' && bear make" mc "bear make clean" mca "bear make clean && printf '\033c' && bear make" rmc "rm compile_commands.json" # ]]] make # # chezmoi [[[ # zm "chezmoi" za "chezmoi add" zar "chezmoi add -r" zd "chezmoi data" zdf "chezmoi diff" zp "chezmoi -v apply" # ]]] chezmoi # # spotify-lib-vis [[[ # # start spv server outside dir ssv "source ../bin/activate.fish && python manage.py runserver" # open spv db in psql spvdb "psql -d spotifyvis -U django" mig "python manage.py makemigrations && python manage.py migrate --run-syncdb && ssv" cldb "python manage.py flush --no-input && ssv" # django shell djs "python manage.py shell" # update pip upip "pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U" # update pip req's. ureq "pip freeze > requirements.txt" # show last history scan hlg "psql -d spotifyvis -a -f /home/kevin/coding/spotify-lib-vis/src/scripts/history.sql | rg 2019 | tac" slg "tail -n 5 $spv_dir/src/api/management/commands/update-history.log" # scan history # hs "$spv_dir/src/update-history.sh && cat $spv_dir/src/api/management/commands/update-history.log | tail -n 1" # removes all but newest file # rmol "ls -t | tail -n +2 | xargs rm -- && l" snw "spotify-now -i '%artist - %title'" svd "pg_dump spotifyvis > spotifyvis.bak" # ]]] spotify-lib-vis # shc "shellcheck" tll "tllocalmgr" tli "tllocalmgr install" # tlh "tllocalmgr texhash" pdl "pdflatex" tcl "tex-clean" # grocery-finder [[[ # wl0 "watson log --all --project=309 --tag=phase2" wr0 "watson report --all --project=309 --tag=phase2" # server [[[ # # nd "node" ndm "nodemon" knd "killall node" mg "mongo" 0ht "cd ~/school/309-proj && python3 -m http.server" mgd "mongod --dbpath mongo-data" # nds "killall node && nodemon server.js" nds "nodemon server.js" # ]]] server # # heroku [[[ # hr "heroku" hrs "heroku local web" hrt "heroku ps" hrl "heroku logs --dyno web -n 1500 | rg up | awk '{ system(\"date -d \" \$1); \$1 = \"\"; print \$0 }' | paste -s -d' \n'" gpsh "git push heroku" 0c "node collections.js" # ]]] heroku # # ]]] 309 # # mfs [[[ # ht "python3 -m http.server" # j "jekyll" # js "jekyll serve" h "hugo" he "hugo serve -D --disableFastRender" # ]]] mfs # ssb "ssh-bandit" rt "python ~/coding/rt-scraper/!rt-scraper.py" # ada-mario [[[ # mm "printf '\033c' && bear make clean move_mouse_with_head && ./move_mouse_with_head" med "printf '\033c' && bear make clean eye_detector && ./eye_detector" mft "printf '\033c' && bear make clean face_detector && ./face_detector" rft "~/coding/face-tracker/face_detector > /tmp/move_mouse_with_head.out" gpsb "git push bitbucket" # ]]] ada-mario # sac "source ../../bin/activate.fish" dea "deactivate" whe "watch echo" vst "cp ~/Documents/workout-logs/stretching.md /tmp && nvim /tmp/stretching.md" # ]]] coding projs # # games [[[ # wlm "watson log --all --project=minetest" wrm "watson report --all --project=minetest" wamv "watson start minetest +video" mtg "minetest" ms "minetestserver" msc "minetestserver --gameid minetest --worldname Creative --terminal" # msh "minetestserver --gameid minetest --worldname Hevin --config ~/.minetest/hevin.conf --terminal" msh "minetestserver --gameid mineclone2 --worldname Hevin-MC --config ~/.minetest/hevin-mc.conf --terminal" msv "minetestserver --gameid minimal --worldname Test --terminal" # mtrsy "rsync -vr .minetest/ /mnt/linux-files/.minetest/" tet "pandoc -f markdown -t html twitch-emote-conversion.md | xclip -selection clipboard" # ]]] games # # school [[[ # # basic # wlf "watson log --all --tag=final" # wrf "watson report --all --tag=final" ssc "mosh mokkar@teach.cs.utoronto.ca" # alg course jc "javac -d out *.java" jr "java -cp \"$CLASSPATH:out\"" # 263 wl6 "watson log --all --project=263 --tag=a5" wr6 "watson report --all --project=263 --tag=a5" z6 "zathura --fork ~/school/263/Introduction-to-Algorithms-CLRs/Introduction\ to\ Algorithms\ -\ 3rd\ Edition.pdf" pd6 "pdflatex a5" # ]]] school #