369-a4 fxn's: run, hex converter, block to line

- switch from pacman to yay
  - update packages
- apparent size du
This commit is contained in:
2019-03-21 11:20:51 -04:00
parent 3b9743fd4f
commit 8e856eb64e
15 changed files with 201 additions and 86 deletions

View File

@@ -9,25 +9,34 @@ set -x GPG_TTY (tty)
# }}} login to X #
# input
# fish-specific {{{ #
fish_vi_key_bindings
set -x EDITOR nvim
set -x VISUAL nvim
set -U fish_help_browser firefox
builtin cd $last_dir
bind \ce edit_command_buffer
bind \cr forward-word
# fish-specific
/home/kevin/linux-config/scripts/sync-shortcuts
source /home/kevin/.config/fish/key_abbr.fish
set -U fish_fxn_dir "/home/kevin/linux-config/fish/.config/fish/functions"
abbr ff "cd $fish_fxn_dir"
for fxn in (find $fish_fxn_dir -name '*.fish')
source $fxn
end
source /home/kevin/.config/fish/key_abbr.fish
abbr rf "source ~/.config/fish/config.fish"
abbr rfs "sync-shortcuts && source ~/.config/fish/config.fish"
abbr xf "fish_config"
abbr f. "cd .."
abbr f.. "cd ../.."
abbr mt "math ''"
# }}} fish-specific #
# universal var's {{{ #
# spv
set -U spv_dir "/home/kevin/coding/spotify-lib-vis"
@@ -43,7 +52,12 @@ set -xU XSET_DELAY 200
# xmodmap ~/.Xmodmap && xset r rate $XSET_DELAY $XSET_RATE
# xset r rate $XSET_DELAY $XSET_RATE
# fxn abbr's
set -U BROWSER "chromium"
# }}} universal var's #
# fxn abbr's {{{ #
abbr ag "grep-aliases"
abbr bq "benq-brightness"
abbr cpc "copy cat"
@@ -65,19 +79,26 @@ abbr hst "$EDITOR ~/.local/share/fish/fish_history"
abbr ut "unix-timestamp"
abbr uzr "unzip-rm"
set -U BROWSER "chromium"
# }}} fxn abbr's #
abbr hm "cd $mfs_dir && hugo serve -D --disableFastRender"
# school {{{ #
# 309
abbr r0t "revert-e3-json restaurants"
abbr r0s "revert-e3-json reservations"
# abbr r0t "./revert-e3-json restaurants"
# abbr r0s "./revert-e3-json reservations"
# 369
abbr grc "grep-c"
abbr grh "grep-headers"
abbr rgh "rg-headers"
abbr r6 "run-a3 f d o"
abbr r6g "run-a3 f d g"
abbr r6s "run-a3 s c o"
abbr g6 "source $fish_fxn_dir/369/a3/gdb-a3-break.fish && gdb-a3-break c c"
abbr r6 "run-a4 h e"
# abbr r6 "run-a3 f d o"
# abbr r6g "run-a3 f d g"
# abbr r6s "run-a3 s c o"
# abbr g6 "source $fish_fxn_dir/369/a3/gdb-a3-break.fish && gdb-a3-break c c"
# }}} school #

View 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

View 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

View File

@@ -0,0 +1,29 @@
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'
end
switch $argv[1]
case h
./ext2_helpers_tester 'imgs/multilevel.img' '/level1/level2/bfile'
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 '*'
./readimage $img_file
end
end

View File

@@ -1,5 +1,5 @@
function grep-aliases
set key_aliases /home/kevin/linux-config/aliases/key_aliases
# grep $argv[1] $key_aliases
rg "^$argv[1]" $key_aliases
rg $argv[1] $key_aliases
# rg "^$argv[1]" $key_aliases
end

View File

@@ -1,3 +0,0 @@
function revert-e3-json
cp $argv[1]_example.json $argv[1].json
end