Remove private_ prefix from fish dir's
This commit is contained in:
5
dot_config/fish/functions/369/a2/carsim.fish
Executable file
5
dot_config/fish/functions/369/a2/carsim.fish
Executable file
@@ -0,0 +1,5 @@
|
||||
function carsim
|
||||
printf '\033c'
|
||||
# and ./carsim stop $argv[1] $argv[2]
|
||||
and ./carsim light $argv[1] $argv[2]
|
||||
end
|
||||
15
dot_config/fish/functions/369/a2/gdb-a2.fish
Executable file
15
dot_config/fish/functions/369/a2/gdb-a2.fish
Executable file
@@ -0,0 +1,15 @@
|
||||
function gdb-a2
|
||||
# gdb -ex "b safeStopSign.c:96" -ex "run" \
|
||||
# gdb -ex "b safeTrafficLight.c:98" -ex "run" \
|
||||
gdb -ex "run" -ex "bt" \
|
||||
# gdb -ex "run" \
|
||||
# -ex "p cur_lane_queue.count" \
|
||||
# -ex "p cur_front->car->index" \
|
||||
# -ex "p cur_front->car" \
|
||||
# -ex "p cur_front" \
|
||||
# --args ./carsim stop 1 4
|
||||
# --args ./carsim stop 3 20
|
||||
# --args ./carsim light 1 4
|
||||
--args ./carsim light 1 20
|
||||
# gdb -ex "b safeStopSign.c:86" -ex "run" --args ./carsim stop 1 10
|
||||
end
|
||||
30
dot_config/fish/functions/369/a3/gdb-a3-break.fish
Executable file
30
dot_config/fish/functions/369/a3/gdb-a3-break.fish
Executable file
@@ -0,0 +1,30 @@
|
||||
function gdb-a3-break
|
||||
# 1 = trace file, 2 = alg
|
||||
set trace_file 'traceprogs/tr-custom.ref'
|
||||
set memsize 3
|
||||
set swapsize 10
|
||||
if test $argv[1] = 's'
|
||||
set trace_file 'traceprogs/tr-simpleloop.ref'
|
||||
set memsize 50
|
||||
set swapsize 3000
|
||||
end
|
||||
|
||||
set alg 'rand'
|
||||
switch $argv[2]
|
||||
case f
|
||||
set alg 'fifo'
|
||||
case l
|
||||
set alg 'lru'
|
||||
case c
|
||||
set alg 'clock'
|
||||
end
|
||||
|
||||
printf '\033c'
|
||||
and bear make
|
||||
and gdb \
|
||||
# -ex "b pagetable.c:69" \
|
||||
# -ex "b sim.c:158" \
|
||||
-ex "b clock.c:29" \
|
||||
-ex "run" \
|
||||
--args ./sim -f $trace_file -m $memsize -s $swapsize -a $alg
|
||||
end
|
||||
49
dot_config/fish/functions/369/a3/run-a3.fish
Executable file
49
dot_config/fish/functions/369/a3/run-a3.fish
Executable file
@@ -0,0 +1,49 @@
|
||||
function run-a3
|
||||
# 1 = alg, 2 = trace file, 3 = output
|
||||
|
||||
set memsize 3
|
||||
set swapsize 10
|
||||
set alg 'rand'
|
||||
switch $argv[1]
|
||||
case f
|
||||
set alg 'fifo'
|
||||
set trace_file 'traceprogs/tr-fifo.ref'
|
||||
case l
|
||||
set alg 'lru'
|
||||
set trace_file 'traceprogs/tr-lru.ref'
|
||||
case c
|
||||
set alg 'clock'
|
||||
set trace_file 'traceprogs/tr-clock.ref'
|
||||
end
|
||||
|
||||
switch $argv[2]
|
||||
case c
|
||||
set trace_file 'traceprogs/tr-custom.ref'
|
||||
case s
|
||||
set trace_file 'traceprogs/tr-simpleloop.ref'
|
||||
set memsize 50
|
||||
set swapsize 3000
|
||||
case m
|
||||
set trace_file 'traceprogs/tr-matmul.ref'
|
||||
set memsize 100
|
||||
set swapsize 3000
|
||||
end
|
||||
|
||||
printf '\033c'
|
||||
# and bear make clean
|
||||
and bear make
|
||||
|
||||
switch $argv[3]
|
||||
case f
|
||||
./sim -f $trace_file -m $memsize -s $swapsize -a $alg > a3.out 2>&1
|
||||
case g
|
||||
gdb -ex "run" -ex "bt" -ex "q" \
|
||||
--args ./sim -f $trace_file -m $memsize -s $swapsize -a $alg
|
||||
case o
|
||||
./sim -f $trace_file -m $memsize -s $swapsize -a $alg
|
||||
end
|
||||
|
||||
if test (count swapfile.*) -gt 0
|
||||
rm swapfile.*
|
||||
end
|
||||
end
|
||||
5
dot_config/fish/functions/369/a4/block-to-line.fish
Executable file
5
dot_config/fish/functions/369/a4/block-to-line.fish
Executable file
@@ -0,0 +1,5 @@
|
||||
function block-to-line
|
||||
set block_size 1024
|
||||
set bytes_per_line 16
|
||||
math "($block_size*$argv[1])/$bytes_per_line + 1"
|
||||
end
|
||||
15
dot_config/fish/functions/369/a4/executable_revert-image.fish
Executable file
15
dot_config/fish/functions/369/a4/executable_revert-image.fish
Executable file
@@ -0,0 +1,15 @@
|
||||
function revert-image
|
||||
set img_file 'emptydisk.img'
|
||||
switch $argv[1]
|
||||
case 1
|
||||
set img_file 'onefile.img'
|
||||
case m
|
||||
set img_file 'multilevel.img'
|
||||
case l
|
||||
set img_file 'largefile.img'
|
||||
case s
|
||||
set img_file 'symlink.img'
|
||||
end
|
||||
|
||||
cp imgs{-cp,}/$img_file
|
||||
end
|
||||
12
dot_config/fish/functions/369/a4/hex.fish
Executable file
12
dot_config/fish/functions/369/a4/hex.fish
Executable file
@@ -0,0 +1,12 @@
|
||||
function hex
|
||||
switch $argv[1]
|
||||
case h
|
||||
# print dec/bin.
|
||||
printf "%d " (echo "ibase=16;obase=A;$argv[2]" | bc)
|
||||
printf "%d\n" (echo "ibase=16;obase=2;$argv[2]" | bc)
|
||||
case d
|
||||
# print hex/bin.
|
||||
printf "%s " (echo "obase=16;$argv[2]" | bc)
|
||||
printf "%d\n" (echo "obase=2;$argv[2]" | bc)
|
||||
end
|
||||
end
|
||||
3
dot_config/fish/functions/369/a4/mount-image.fish
Executable file
3
dot_config/fish/functions/369/a4/mount-image.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function mount-image
|
||||
sudo mount $argv[1] /mnt/369-a4
|
||||
end
|
||||
35
dot_config/fish/functions/369/a4/run-a4.fish
Executable file
35
dot_config/fish/functions/369/a4/run-a4.fish
Executable file
@@ -0,0 +1,35 @@
|
||||
function run-a4
|
||||
# 1 = ex, 2 = img
|
||||
printf '\033c'
|
||||
# and bear make clean
|
||||
bear make
|
||||
|
||||
set img_file 'imgs/emptydisk.img'
|
||||
switch $argv[2]
|
||||
case 1
|
||||
set img_file 'imgs/onefile.img'
|
||||
case m
|
||||
set img_file 'imgs/multilevel.img'
|
||||
case l
|
||||
set img_file 'imgs/largefile.img'
|
||||
case s
|
||||
set img_file 'imgs/symlink.img'
|
||||
end
|
||||
|
||||
switch $argv[1]
|
||||
case h
|
||||
./ext2_helpers_tester $img_file
|
||||
case hg
|
||||
gdb -ex "run" -ex "bt" -ex "q" \
|
||||
--args ./ext2_helpers_tester './imgs/multilevel.img' '/level1/level2/level3//'
|
||||
case m
|
||||
./ext2_mkdir $img_file '/'
|
||||
# ./ext2_mkdir 'imgs/multilevel.img' '/level1/level2/bfile'
|
||||
case rg
|
||||
./readimage $img_file
|
||||
gdb -ex "run" -ex "bt" -ex "q" \
|
||||
--args ./readimage './imgs/symlink.img'
|
||||
case '*'
|
||||
./readimage $img_file
|
||||
end
|
||||
end
|
||||
3
dot_config/fish/functions/369/grep-c.fish
Executable file
3
dot_config/fish/functions/369/grep-c.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function grep-c
|
||||
grep -nr --include \*.c $argv[1] ./
|
||||
end
|
||||
3
dot_config/fish/functions/369/grep-headers.fish
Executable file
3
dot_config/fish/functions/369/grep-headers.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function grep-headers
|
||||
grep --color=auto -nr --include \*.h $argv[1] ./
|
||||
end
|
||||
3
dot_config/fish/functions/369/rg-headers.fish
Executable file
3
dot_config/fish/functions/369/rg-headers.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function rg-headers
|
||||
rg $argv[1] *.h
|
||||
end
|
||||
3
dot_config/fish/functions/369/rgc.fish
Executable file
3
dot_config/fish/functions/369/rgc.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function rgc
|
||||
rg $argv[1] *.c
|
||||
end
|
||||
3
dot_config/fish/functions/benq-brightness.fish
Executable file
3
dot_config/fish/functions/benq-brightness.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function benq-brightness
|
||||
xrandr --output HDMI-0 --gamma 1:0.8:0 --brightness (math $argv[1] / 100)
|
||||
end
|
||||
53
dot_config/fish/functions/cd.fish
Executable file
53
dot_config/fish/functions/cd.fish
Executable file
@@ -0,0 +1,53 @@
|
||||
#
|
||||
# Wrap the builtin cd command to maintain directory history.
|
||||
#
|
||||
function cd --description "Change directory"
|
||||
set -l MAX_DIR_HIST 25
|
||||
|
||||
if test (count $argv) -gt 1
|
||||
printf "%s\n" (_ "Too many args for cd command")
|
||||
return 1
|
||||
end
|
||||
|
||||
# Skip history in subshells.
|
||||
if status --is-command-substitution
|
||||
builtin cd $argv
|
||||
return $status
|
||||
end
|
||||
|
||||
# Avoid set completions.
|
||||
set -l previous $PWD
|
||||
|
||||
if test "$argv" = "-"
|
||||
if test "$__fish_cd_direction" = "next"
|
||||
nextd
|
||||
else
|
||||
prevd
|
||||
end
|
||||
return $status
|
||||
end
|
||||
|
||||
# allow explicit "cd ." if the mount-point became stale in the meantime
|
||||
if test "$argv" = "."
|
||||
cd "$PWD"
|
||||
return $status
|
||||
end
|
||||
|
||||
builtin cd $argv
|
||||
set -l cd_status $status
|
||||
|
||||
if test $cd_status -eq 0 -a "$PWD" != "$previous"
|
||||
set -q dirprev
|
||||
or set -l dirprev
|
||||
set -q dirprev[$MAX_DIR_HIST]
|
||||
and set -e dirprev[1]
|
||||
set -g -a dirprev $previous
|
||||
set -e dirnext
|
||||
set -g __fish_cd_direction prev
|
||||
|
||||
set -U last_dir $PWD
|
||||
lsd -a
|
||||
end
|
||||
|
||||
return $cd_status
|
||||
end
|
||||
9
dot_config/fish/functions/certbot-ssl.fish
Executable file
9
dot_config/fish/functions/certbot-ssl.fish
Executable file
@@ -0,0 +1,9 @@
|
||||
function certbot-ssl
|
||||
set domain_args ""
|
||||
for domain in $argv
|
||||
set -a domain_args "-d" $domain
|
||||
end
|
||||
echo sudo certbot certonly --manual --preferred-challenges=dns \
|
||||
--email kevin.mok@live.ca --server https://acme-v02.api.letsencrypt.org/directory \
|
||||
--agree-tos $domain_args
|
||||
end
|
||||
3
dot_config/fish/functions/copy.fish
Executable file
3
dot_config/fish/functions/copy.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function copy
|
||||
$argv[1] $argv[2] | xclip -selection clipboard
|
||||
end
|
||||
5
dot_config/fish/functions/create-fish-function.fish
Executable file
5
dot_config/fish/functions/create-fish-function.fish
Executable file
@@ -0,0 +1,5 @@
|
||||
function create-fish-function
|
||||
printf 'function %s\nend' $argv[1] > $fish_fxn_dir/$argv[1].fish
|
||||
and cd $fish_fxn_dir
|
||||
and $EDITOR $argv[1].fish
|
||||
end
|
||||
3
dot_config/fish/functions/evince-silent.fish
Executable file
3
dot_config/fish/functions/evince-silent.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function evince-silent
|
||||
evince $argv[1] > /dev/null 2>&1&
|
||||
end
|
||||
3
dot_config/fish/functions/find-vim-filetype.fish
Executable file
3
dot_config/fish/functions/find-vim-filetype.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function find-vim-filetype
|
||||
fd $argv[1] /usr/share/nvim/runtime/ftplugin /usr/share/nvim/runtime/syntax
|
||||
end
|
||||
5
dot_config/fish/functions/git/git-amend-push.fish
Executable file
5
dot_config/fish/functions/git/git-amend-push.fish
Executable file
@@ -0,0 +1,5 @@
|
||||
function git-amend-push
|
||||
git add -A .
|
||||
and git commit --amend --no-edit -S
|
||||
and git push --force
|
||||
end
|
||||
4
dot_config/fish/functions/git/git-delete-branch.fish
Executable file
4
dot_config/fish/functions/git/git-delete-branch.fish
Executable file
@@ -0,0 +1,4 @@
|
||||
function git-delete-branch
|
||||
git push origin --delete $argv[1]
|
||||
and git branch -D $argv[1]
|
||||
end
|
||||
3
dot_config/fish/functions/git/git-diff-files.fish
Executable file
3
dot_config/fish/functions/git/git-diff-files.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function git-diff-files
|
||||
git diff --name-only $argv[1] $argv[2]
|
||||
end
|
||||
5
dot_config/fish/functions/git/git-mult-remotes.fish
Executable file
5
dot_config/fish/functions/git/git-mult-remotes.fish
Executable file
@@ -0,0 +1,5 @@
|
||||
function git-mult-remotes
|
||||
git remote set-url --add --push origin $argv[1]
|
||||
and git remote set-url --add --push origin $argv[2]
|
||||
and git remote -v
|
||||
end
|
||||
5
dot_config/fish/functions/git/git-push-multiple.fish
Executable file
5
dot_config/fish/functions/git/git-push-multiple.fish
Executable file
@@ -0,0 +1,5 @@
|
||||
function git-push-multiple
|
||||
git remote set-url --add --push origin $argv[1]
|
||||
and git remote set-url --add --push origin $argv[2]
|
||||
and git remote -v
|
||||
end
|
||||
5
dot_config/fish/functions/grep-aliases.fish
Executable file
5
dot_config/fish/functions/grep-aliases.fish
Executable file
@@ -0,0 +1,5 @@
|
||||
function grep-aliases
|
||||
set key_aliases ~/key_aliases
|
||||
rg $argv[1] $key_aliases
|
||||
# rg "^$argv[1]" $key_aliases
|
||||
end
|
||||
4
dot_config/fish/functions/grep-pdf-file.fish
Executable file
4
dot_config/fish/functions/grep-pdf-file.fish
Executable file
@@ -0,0 +1,4 @@
|
||||
function grep-pdf-file
|
||||
pdfgrep -n $argv[1] -B $argv[2] -A $argv[3] (fd -e pdf --no-ignore-vcs) > grep-$argv[1].txt
|
||||
and nvim grep-$argv[1].txt -c "/$argv[1]"
|
||||
end
|
||||
3
dot_config/fish/functions/grep-pdf.fish
Executable file
3
dot_config/fish/functions/grep-pdf.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function grep-pdf
|
||||
pdfgrep -n $argv[1] (fd -e pdf --no-ignore-vcs)
|
||||
end
|
||||
3
dot_config/fish/functions/pastebin.fish
Executable file
3
dot_config/fish/functions/pastebin.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function pastebin
|
||||
cat $argv[1] | curl -F 'sprunge=<-' http://sprunge.us
|
||||
end
|
||||
3
dot_config/fish/functions/redshift-set.fish
Executable file
3
dot_config/fish/functions/redshift-set.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function redshift-set
|
||||
redshift -x && redshift -O (math "$argv[1] * 100")
|
||||
end
|
||||
7
dot_config/fish/functions/scan-history.fish
Executable file
7
dot_config/fish/functions/scan-history.fish
Executable file
@@ -0,0 +1,7 @@
|
||||
function scan-history
|
||||
sudo systemctl start postgresql.service
|
||||
# and systemctl status postgresql.service
|
||||
and source $spv_dir/src/scripts/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
|
||||
3
dot_config/fish/functions/shred-rm.fish
Executable file
3
dot_config/fish/functions/shred-rm.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function shred-rm
|
||||
shred $argv && rm $argv
|
||||
end
|
||||
3
dot_config/fish/functions/ssh-bandit.fish
Executable file
3
dot_config/fish/functions/ssh-bandit.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function ssh-bandit
|
||||
sshpass -f p/$argv[1] ssh -p 2220 bandit$argv[1]@bandit.labs.overthewire.org
|
||||
end
|
||||
4
dot_config/fish/functions/unix-timestamp.fish
Executable file
4
dot_config/fish/functions/unix-timestamp.fish
Executable file
@@ -0,0 +1,4 @@
|
||||
# convert unix timestamp
|
||||
function unix-timestamp
|
||||
date -d @$argv[1]
|
||||
end
|
||||
4
dot_config/fish/functions/unzip-rm.fish
Executable file
4
dot_config/fish/functions/unzip-rm.fish
Executable file
@@ -0,0 +1,4 @@
|
||||
function unzip-rm
|
||||
unzip $argv[1]
|
||||
and rm $argv[1]
|
||||
end
|
||||
4
dot_config/fish/functions/vsnp.fish
Executable file
4
dot_config/fish/functions/vsnp.fish
Executable file
@@ -0,0 +1,4 @@
|
||||
function vsnp
|
||||
set snips_dir "/home/kevin/.vim/plugged/vim-snippets/UltiSnips"
|
||||
$EDITOR $snips_dir/$argv[1].snippets
|
||||
end
|
||||
3
dot_config/fish/functions/wc-pdf.fish
Executable file
3
dot_config/fish/functions/wc-pdf.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
function wc-pdf
|
||||
pdftotext $argv[1] - | wc -w
|
||||
end
|
||||
Reference in New Issue
Block a user