From 70a2fbf2f39b01c020241a5164be649b73216426 Mon Sep 17 00:00:00 2001 From: Kevin Mok Date: Fri, 8 Mar 2019 02:32:57 -0500 Subject: [PATCH] 369-a3 and other fish functions --- aliases/key_aliases | 22 ++++++++++++++----- fish/.config/fish/config.fish | 13 ++++++++--- fish/.config/fish/functions/cd.fish | 2 +- fish/.config/fish/functions/copy.fish | 3 +++ .../fish/functions/create-fish-function.fish | 5 +++++ fish/.config/fish/functions/gdb-a3.fish | 6 +++++ fish/.config/fish/functions/grep-aliases.fish | 3 ++- fish/.config/fish/functions/rg-headers.fish | 3 +++ fish/.config/fish/functions/rgc.fish | 3 +++ fish/.config/fish/functions/run-a3.fish | 7 ++++++ fish/.config/fish/functions/scan-history.fish | 5 +++-- neofetch/.config/neofetch/config.conf | 2 +- txt/exclude-dirs-backup.txt | 1 + txt/key_dirs.txt | 2 +- 14 files changed, 62 insertions(+), 15 deletions(-) create mode 100644 fish/.config/fish/functions/copy.fish create mode 100644 fish/.config/fish/functions/create-fish-function.fish create mode 100644 fish/.config/fish/functions/gdb-a3.fish create mode 100644 fish/.config/fish/functions/rg-headers.fish create mode 100644 fish/.config/fish/functions/rgc.fish create mode 100644 fish/.config/fish/functions/run-a3.fish diff --git a/aliases/key_aliases b/aliases/key_aliases index 8fe70bb..349d587 100644 --- a/aliases/key_aliases +++ b/aliases/key_aliases @@ -9,6 +9,8 @@ fi "fish" ru "xrdb ~/.Xresources" # list file sizes in megabytes with depth 1 duh "sudo du -d 1 -h" +dum "sudo du -d 1 -m" +m "man" tl "tldr" nvt "nvidia-settings --assign CurrentMetaMode='DVI-I-1: nvidia-auto-select +0+0 {ForceCompositionPipeline=On}, HDMI-0: nvidia-auto-select +3840+0 {ForceCompositionPipeline=On}'" @@ -24,7 +26,7 @@ grr "grep -r" cld "colordiff -y --suppress-common-lines" mkpk "makepkg -sri" -mkex "chmod 777" +ex "chmod 777" # systemctl {{{ # @@ -59,6 +61,7 @@ fz "fzf" fnd "find . -type f -name" rmr "rm -rf" +rmd "rm ~/Downloads/*" md "mkdir -p" rsy "rsync -Pr" @@ -70,7 +73,7 @@ ds "df -h | head -n 1 && df -h | grep sd" chownw "sudo chown -R kevin:wheel" chwnm "sudo chown -R kevin:wheel /run/media/kevin" # cd into backup folder and show backup sizes -nbu "f /run/media/kevin/pc-backup/backups/nzxt && ll | grep gz" +nbu "cd /run/media/kevin/backup-hd/nzxt/tar && lsd -l" # }}} directory-related # @@ -166,7 +169,7 @@ pse "pass edit" psi "pass insert -m" psg "pass generate -c" -xclip "xclip -selection clipboard" +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" @@ -216,6 +219,7 @@ gro "git remote show origin" 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" @@ -357,18 +361,24 @@ ssb "ssh-bandit" # 369 {{{ # -# a2 -m "printf '\033c' && bear make" +ma "printf '\033c' && bear make" mc "bear make clean" + +rms "rm swapfile.*" + +# a2 {{{ # + mcr "bear make clean && printf '\033c' && bear make && ./carsim light 1 20" # mr "printf '\033c' && make && ./carsim stop 10 20" -mr "printf '\033c' && bear make && ./carsim light 1 20" +# mr "printf '\033c' && bear make && ./carsim light 1 20" # "valgrind --tool=helgrind ./carsim stop 10 50 > helgrind.txt 2>&1 && valgrind --tool=helgrind ./carsim light 10 50 >> helgrind.txt 2>&1" # lk "valgrind --leak-check=yes ./carsim stop 10 20" lk "valgrind --leak-check=yes ./carsim light 1 1" # hl "valgrind --tool=helgrind ./carsim stop 10 20" hl "valgrind --tool=helgrind ./carsim light 10 20" +# }}} a2 # + # a1 # sa "ssh k@192.168.0.17" # cpi "scp interceptor.c kevin@192.168.0.17:/home/kevin/a1" diff --git a/fish/.config/fish/config.fish b/fish/.config/fish/config.fish index 61c2698..ded7226 100644 --- a/fish/.config/fish/config.fish +++ b/fish/.config/fish/config.fish @@ -19,6 +19,8 @@ bind \ce edit_command_buffer bind \cr forward-word # fish-specific +set -U fish_fxn_dir "/home/kevin/linux-config/fish/.config/fish/functions" +abbr ff "cd $fish_fxn_dir" source /home/kevin/.config/fish/key_abbr.fish abbr xf "fish_config" abbr f. "cd .." @@ -27,7 +29,6 @@ abbr f.. "cd ../.." # spv set -U spv_dir "/home/kevin/coding/spotify-lib-vis" set -U mfs_dir "/home/kevin/coding/mf-site" -source $spv_dir/src/api-keys.sh # set -U PATH /usr/local/sbin /usr/local/bin /usr/bin /usr/bin/site_perl /usr/bin/vendor_perl /usr/bin/core_perl /home/kevin/linux-config/scripts # (ruby -e 'print Gem.user_dir')/bin @@ -42,6 +43,7 @@ set -xU XSET_DELAY 200 # fxn abbr's abbr ag "grep-aliases" abbr bq "benq-brightness" +abbr cf "create-fish-function" abbr ev "evince-silent" # git {{{ # @@ -60,7 +62,12 @@ abbr z "zathura-silent" set -U BROWSER "chromium" abbr hm "cd $mfs_dir && hugo serve -D --disableFastRender" -abbr ga2 "gdb-a2" +# 369 abbr grc "grep-c" abbr grh "grep-headers" -abbr cs "carsim" +abbr rgh "rg-headers" + +abbr r6 "run-a3" + +# abbr cs "carsim" +# abbr ga2 "gdb-a2" diff --git a/fish/.config/fish/functions/cd.fish b/fish/.config/fish/functions/cd.fish index 84e899d..ffc7f47 100644 --- a/fish/.config/fish/functions/cd.fish +++ b/fish/.config/fish/functions/cd.fish @@ -46,7 +46,7 @@ function cd --description "Change directory" set -g __fish_cd_direction prev set -U last_dir $PWD - ls -a + lsd -a end return $cd_status diff --git a/fish/.config/fish/functions/copy.fish b/fish/.config/fish/functions/copy.fish new file mode 100644 index 0000000..2c9234c --- /dev/null +++ b/fish/.config/fish/functions/copy.fish @@ -0,0 +1,3 @@ +function copy + $argv[1] $argv[2] | xclip -selection clipboard +end diff --git a/fish/.config/fish/functions/create-fish-function.fish b/fish/.config/fish/functions/create-fish-function.fish new file mode 100644 index 0000000..8de1eac --- /dev/null +++ b/fish/.config/fish/functions/create-fish-function.fish @@ -0,0 +1,5 @@ +function create-fish-function + printf 'function %s\n \nend' $argv[1] > $fish_fxn_dir/$argv[1].fish + and cd $fish_fxn_dir + and $EDITOR $argv[1].fish +end diff --git a/fish/.config/fish/functions/gdb-a3.fish b/fish/.config/fish/functions/gdb-a3.fish new file mode 100644 index 0000000..acf858f --- /dev/null +++ b/fish/.config/fish/functions/gdb-a3.fish @@ -0,0 +1,6 @@ +function gdb-a3 + # gdb -ex "b safeStopSign.c:96" -ex "run" \ + gdb -ex "run" -ex "bt" \ + # gdb -ex "run" \ + --args ./sim -f /home/kevin/school/369/a3/a3/traceprogs/tr-simpleloop.ref -m 50 -s 3000 -a rand +end diff --git a/fish/.config/fish/functions/grep-aliases.fish b/fish/.config/fish/functions/grep-aliases.fish index 0cf78b2..e136bc9 100644 --- a/fish/.config/fish/functions/grep-aliases.fish +++ b/fish/.config/fish/functions/grep-aliases.fish @@ -1,4 +1,5 @@ function grep-aliases set key_aliases /home/kevin/linux-config/aliases/key_aliases - grep $argv[1] $key_aliases + # grep $argv[1] $key_aliases + rg "^$argv[1]" $key_aliases end diff --git a/fish/.config/fish/functions/rg-headers.fish b/fish/.config/fish/functions/rg-headers.fish new file mode 100644 index 0000000..901cb42 --- /dev/null +++ b/fish/.config/fish/functions/rg-headers.fish @@ -0,0 +1,3 @@ +function rg-headers + rg $argv[1] *.h +end diff --git a/fish/.config/fish/functions/rgc.fish b/fish/.config/fish/functions/rgc.fish new file mode 100644 index 0000000..aaa9456 --- /dev/null +++ b/fish/.config/fish/functions/rgc.fish @@ -0,0 +1,3 @@ +function rgc + rg $argv[1] *.c +end diff --git a/fish/.config/fish/functions/run-a3.fish b/fish/.config/fish/functions/run-a3.fish new file mode 100644 index 0000000..9641d63 --- /dev/null +++ b/fish/.config/fish/functions/run-a3.fish @@ -0,0 +1,7 @@ +function run-a3 + printf '\033c' + and bear make + and ./sim -f /home/kevin/school/369/a3/a3/traceprogs/tr-simpleloop.ref -m 50 -s 3000 -a rand + + rm swapfile.* +end diff --git a/fish/.config/fish/functions/scan-history.fish b/fish/.config/fish/functions/scan-history.fish index 6503956..7b2bea5 100644 --- a/fish/.config/fish/functions/scan-history.fish +++ b/fish/.config/fish/functions/scan-history.fish @@ -1,6 +1,7 @@ function scan-history sudo systemctl start postgresql.service - and systemctl status postgresql.service - and $spv_dir/src/update-history.sh + # and systemctl status postgresql.service + and source $spv_dir/src/api-keys.sh + and $spv_dir/src/scripts/update-history.sh and cat $spv_dir/src/api/management/commands/update-history.log | tail -n 1 end diff --git a/neofetch/.config/neofetch/config.conf b/neofetch/.config/neofetch/config.conf index 9a428b8..da23bdf 100644 --- a/neofetch/.config/neofetch/config.conf +++ b/neofetch/.config/neofetch/config.conf @@ -336,7 +336,7 @@ public_ip_host="http://ident.me" # disk_show=('/'): # 'Disk (/): 74G / 118G (66%)' # -disk_show=('/' '/home' ) +disk_show=('/' '/home' '/mnt/linux-files' ) # Disk subtitle. # What to append to the Disk subtitle. diff --git a/txt/exclude-dirs-backup.txt b/txt/exclude-dirs-backup.txt index a32614b..e469963 100644 --- a/txt/exclude-dirs-backup.txt +++ b/txt/exclude-dirs-backup.txt @@ -7,4 +7,5 @@ /proc /run /sys +/var/cache/pacman /var/lib/systemd/coredump diff --git a/txt/key_dirs.txt b/txt/key_dirs.txt index c0b50b8..8a42f6f 100644 --- a/txt/key_dirs.txt +++ b/txt/key_dirs.txt @@ -3,10 +3,10 @@ bg /home/kevin/Pictures/Backgrounds cf /home/kevin/.config lc /home/kevin/linux-config/ +lf /mnt/linux-files d /home/kevin/Downloads D /home/kevin/Documents fo /home/kevin/.config/fish -ff /home/kevin/linux-config/fish/.config/fish/functions fs /home/kevin/linux-config/fish/.config/fish k /home/kevin/ lc /home/kevin/linux-config/