Browse Source

Update 369-a3 functions

red-hat-laptop
Kevin Mok 6 years ago
parent
commit
3b9743fd4f
Signed by: Kevin-Mok GPG Key ID: AEA75288DC135CF5
  1. 33
      aliases/key_aliases
  2. 17
      fish/.config/fish/config.fish
  3. 20
      fish/.config/fish/functions/369/a3/gdb-a3-break.fish
  4. 35
      fish/.config/fish/functions/369/a3/run-a3.fish
  5. 3
      fish/.config/fish/functions/revert-e3-json.fish
  6. 4
      fish/.config/fish/functions/unzip-rm.fish
  7. 3
      fish/.config/fish/functions/zathura-silent.fish
  8. 6
      i3/.config/i3/config
  9. 7
      ranger/.config/ranger/scope.sh
  10. 6
      txt/key_dirs.txt
  11. 35
      vim/.vimrc

33
aliases/key_aliases

@ -1,4 +1,5 @@
# system {{{ #
# vim: fdm=marker
# clear screen
c "printf '\033c'"
@ -8,8 +9,8 @@ fi "fish"
# reload urxvt
ru "xrdb ~/.Xresources"
# list file sizes in megabytes with depth 1
duh "sudo du -d 1 -h"
dum "sudo du -d 1 -m"
duh "sudo du -d 1 -ah | sort -hr"
dum "sudo du -d 1 -am | sort -hr"
m "man"
tl "tldr"
@ -18,8 +19,8 @@ nvt "nvidia-settings --assign CurrentMetaMode='DVI-I-1: nvidia-auto-select +0+0
vgb "sudo nvim /etc/default/grub"
mkgb "sudo grub-mkconfig -o /boot/grub/grub.cfg"
bt "bat"
bta "bat *"
b "bat"
ba "bat *"
grep "grep --color=auto -n"
grr "grep -r"
# pk "pkill -f"
@ -50,7 +51,7 @@ udmb "udisksctl mount -b /dev/sdc2"
udu "udisksctl unmount -b"
udub "udisksctl unmount -b /dev/sdc2"
to "touch"
tc "touch"
# directory-related {{{ #
ls "lsd"
@ -81,8 +82,9 @@ nbu "cd /run/media/kevin/backup-hd/nzxt/tar && lsd -l"
# power options {{{ #
s "systemctl suspend"
sd "sudo shutdown 0"
rb "sudo shutdown -r 0"
so "xset dpms force off"
sd "systemctl poweroff"
rb "systemctl reboot"
lo "i3-msg exit"
x "xmodmap ~/.Xmodmap && xset r rate $XSET_DELAY $XSET_RATE"
X "xmodmap ~/.Xmodmap && xset r rate $XSET_DELAY $XSET_RATE"
@ -126,8 +128,8 @@ id "identify"
# config files {{{ #
rf "source ~/.config/fish/config.fish"
srf "sync-shortcuts && source ~/.config/fish/config.fish"
rz "source ~/linux-config/aliases/zsh_aliases"
lca "f ~/linux-config/aliases"
pipes "pipes.sh -t 3"
@ -159,6 +161,9 @@ sx "sxiv"
sxa "sxiv -a"
wg "wego"
wp "grep wallpaper ~/.cache/wal/colors.sh"
z "zathura --fork"
lz "unzip -l"
# rsl "java -jar ~/Downloads/RuneLite.jar"
# swex "sudo nohup ~/Downloads/swex.appimage $silent"
@ -233,12 +238,12 @@ grmfc "git rm -f --cached"
# }}} add #
# diff/log {{{ #
gd "git diff -w"
gdc "git diff --cached -w"
gd "git difftool -w --tool=vimdiff"
gdc "git difftool -w --cached --tool=vimdiff"
gdl "git diff -w"
gdlc "git diff --cached -w"
gdh "git diff --cached -w HEAD~1"
gds "git diff --stat"
gdv "git difftool -w --tool=vimdiff"
gdvc "git difftool -w --cached --tool=vimdiff"
gl "git log"
gsl "git shortlog"
# }}} diff/log #
@ -298,6 +303,8 @@ gunc "git update-index --assume-unchanged"
# coding projs {{{ #
# coding_dir="~/coding"
rgt "rg TODO"
# trapbot {{{ #
# tb "$cd_coding_dir/trapbot"
# vtb "$cd_coding_dir/trapbot && ni scan_reddit.py"
@ -397,4 +404,6 @@ hl "valgrind --tool=helgrind ./carsim light 10 20"
wl0 "watson log --all --project=309 --tag=project"
wr0 "watson report --all --project=309 --tag=project"
e3t "node test-app.js"
# }}} school #

17
fish/.config/fish/config.fish

@ -48,6 +48,7 @@ abbr ag "grep-aliases"
abbr bq "benq-brightness"
abbr cpc "copy cat"
abbr cpe "copy echo"
abbr cpp "copy echo (pwd)"
abbr cff "create-fish-function"
abbr ev "evince-silent"
# git {{{ #
@ -62,19 +63,21 @@ abbr grmb "git-delete-branch"
abbr hs "scan-history"
abbr hst "$EDITOR ~/.local/share/fish/fish_history"
abbr ut "unix-timestamp"
abbr z "zathura-silent"
abbr uzr "unzip-rm"
set -U BROWSER "chromium"
abbr hm "cd $mfs_dir && hugo serve -D --disableFastRender"
# 309
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 c lru"
abbr r6o "run-a3 c lru o"
abbr g6b "gdb-a3-break c lru"
# abbr cs "carsim"
# abbr ga2 "gdb-a2"
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"

20
fish/.config/fish/functions/369/a3/gdb-a3-break.fish

@ -1,7 +1,7 @@
function gdb-a3-break
# 1 = trace file, 2 = alg
set trace_file 'traceprogs/tr-custom.ref'
set memsize 1
set memsize 3
set swapsize 10
if test $argv[1] = 's'
set trace_file 'traceprogs/tr-simpleloop.ref'
@ -9,10 +9,22 @@ function gdb-a3-break
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 lru.c:65" \
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 $argv[2]
--args ./sim -f $trace_file -m $memsize -s $swapsize -a $alg
end

35
fish/.config/fish/functions/369/a3/run-a3.fish

@ -1,13 +1,32 @@
function run-a3
# 1 = trace file, 2 = alg, 3 = output
# 1 = alg, 2 = trace file, 3 = output
set trace_file 'traceprogs/tr-custom.ref'
set memsize 3
set swapsize 10
if test $argv[1] = 's'
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'
@ -16,13 +35,15 @@ function run-a3
switch $argv[3]
case f
./sim -f $trace_file -m $memsize -s $swapsize -a $argv[2] > a3.out 2>&1
./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 $argv[2]
--args ./sim -f $trace_file -m $memsize -s $swapsize -a $alg
case o
./sim -f $trace_file -m $memsize -s $swapsize -a $argv[2]
./sim -f $trace_file -m $memsize -s $swapsize -a $alg
end
# rm swapfile.*
if test (count swapfile.*) -gt 0
rm swapfile.*
end
end

3
fish/.config/fish/functions/revert-e3-json.fish

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

4
fish/.config/fish/functions/unzip-rm.fish

@ -0,0 +1,4 @@
function unzip-rm
unzip $argv[1]
and rm $argv[1]
end

3
fish/.config/fish/functions/zathura-silent.fish

@ -1,3 +0,0 @@
function zathura-silent
zathura $argv[1] > /dev/null 2>&1&
end

6
i3/.config/i3/config

@ -1,4 +1,5 @@
# startup {{{ #
# vim: fdm=marker
set $browser "firefox"
# set $browser "chromium"
set $def_term "urxvt"
@ -46,8 +47,8 @@ bindsym Mod4+p exec passmenu
bindsym Mod4+q exec qdirstat
bindsym Mod4+r exec urxvt -e ranger
bindsym Mod4+$mod+r exec notify-send "watson restart" "$(watson restart)"
# bindsym control+$mod+s exec systemctl suspend
bindsym control+$mod+s exec systemctl suspend
bindsym Mod4+$mod+s exec xset dpms force off
# bindsym Mod4+t exec st
bindsym Mod4+t exec xclip -selection clipboard ~/.password-store/social/trapbot
bindsym Mod4+u exec echo 'kevin.mok@mail.utoronto.ca' | xclip -selection clipboard
@ -140,9 +141,11 @@ bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+b split h
bindsym Mod4+$mod+b split h; exec $def_term
# split in vertical orientation
bindsym $mod+v split v
bindsym Mod4+$mod+v split v; exec $def_term
# bindsym control+Shift+x kill
bindsym shift+x kill
@ -326,7 +329,6 @@ bindsym $mod+Shift+5 move container to workspace $ws15; workspace $ws15
# reload config/computer {{{ #
bindsym $mod+Shift+s exec systemctl suspend
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
# bindsym $mod+control+r exec ~/.cache/wal/colors.sh; restart
bindsym $mod+control+r exec i3-msg restart

7
ranger/.config/ranger/scope.sh

@ -90,6 +90,11 @@ handle_extension() {
# lynx -dump -- "${FILE_PATH}" && exit 5
# elinks -dump "${FILE_PATH}" && exit 5
# ;; # Continue with next handler on failure
# JSON
json)
jq --color-output . "${FILE_PATH}" && exit 5
python -m json.tool -- "${FILE_PATH}" && exit 5
esac
}
@ -186,6 +191,8 @@ handle_mime() {
local pygmentize_format='terminal'
local highlight_format='ansi'
fi
# local pygmentize_format='terminal'
# local highlight_format='ansi'
highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" --out-format="${highlight_format}" \
--style="${HIGHLIGHT_STYLE}" --force -- "${FILE_PATH}" && exit 5
# pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}" -- "${FILE_PATH}" && exit 5

6
txt/key_dirs.txt

@ -1,4 +1,5 @@
# sys {{{ *
# vim: fdm=marker
bg /home/kevin/Pictures/Backgrounds
cf /home/kevin/.config
@ -46,13 +47,14 @@ wo /home/kevin/Documents/workout-logs/11
sc /home/kevin/school
0c /home/kevin/school/309-proj/css
0d /home/kevin/school/309
0l /home/kevin/school/309/l
0p /home/kevin/school/309-proj
e2 /home/kevin/school/309/e2
e3 /home/kevin/school/309/e3
# 369
6 /home/kevin/school/369
6f /home/kevin/linux-config/fish/.config/fish/functions/369/a3
a3 /home/kevin/school/369/a3/a3
a3f /home/kevin/linux-config/fish/.config/fish/functions/369/a3
hp /home/kevin/school/hps
lt /home/kevin/school/latex-notes

35
vim/.vimrc

@ -16,6 +16,7 @@ set autoindent
set mouse=a
set clipboard+=unnamedplus
set foldmethod=marker
" set foldmethod=indent
set linespace=5
" cursor indicator {{{ "
@ -46,7 +47,15 @@ autocmd BufNewFile,BufRead *.txt set tabstop=2 shiftwidth=2 expandtab
autocmd BufNewFile,BufRead *.md set filetype=markdown
autocmd Filetype markdown set textwidth=0
" autocmd Filetype html set foldmarker=0
autocmd VimLeave *.tex !tex-clean %
autocmd Filetype markdown map <F8> :LivedownToggle<CR>
autocmd Filetype json nnoremap <leader>j :%!python -m json.tool<CR>
autocmd Filetype json set foldmethod=marker
autocmd FileType sh map <F8> :!clear && shellcheck %<CR>
" autocmd FileType tex map <F8> :VimtexCompile<CR>:VimtexView<CR>
autocmd VimEnter *.tex VimtexCompile
autocmd VimLeave *.tex !tex-clean %:p
" map <F9> :VimtexCompile<CR>
" " auto-reload vimrc {{{ "
@ -66,6 +75,10 @@ autocmd BufRead commit-msg.txt set filetype=gitcommit tw=72
" autocmd BufWritePost key_* !sync-shortcuts
autocmd BufNewFile,BufRead key_* map <F1> :silent !sync-shortcuts<CR>
" map <F1> :silent !scp %:p k@192.168.0.17:/home/k/a1<CR>
" map <F2> :silent !scp -P 2222 e1.html e1_style.css kevin@127.0.0.1:/home/kevin/Downloads/e1<CR>
" map <F6> :make -C ~/Documents/resume cv<CR>
" }}} commands for specific files "
" vim-plug {{{ "
@ -97,10 +110,11 @@ Plug 'vim-scripts/L9'
" automatically save buffers upon returning to normal mode
Plug '907th/vim-auto-save'
let g:auto_save = 1
autocmd VimEnter *.tex let g:auto_save = 0
" provides various functionality for writing LaTeX in Vim
Plug 'lervag/vimtex'
au BufWritePost *.tex silent call Tex_RunLaTeX()
" au BufWritePost *.tex silent call Tex_RunLaTeX()
au BufWritePost *.tex silent !pkill -USR1 xdvi.bin
let g:vimtex_view_general_viewer = 'zathura'
let g:vimtex_quickfix_latexlog = {
@ -199,18 +213,12 @@ colorscheme wal
" Mappings {{{ "
" function keys {{{ "
" map <F1> :silent !scp %:p k@192.168.0.17:/home/k/a1<CR>
" map <F2> :silent !scp -P 2222 e1.html e1_style.css kevin@127.0.0.1:/home/kevin/Downloads/e1<CR>
map <F3> :wa<CR>
map <F4> :xa<CR>
map <F5> :q!<CR>
map <F6> :qa!<CR>
" map <F6> :make -C ~/Documents/resume cv<CR>
" map <F7> :AutoSaveToggle<CR>
map <F8> :!clear && shellcheck %<CR>
map <F9> :VimtexCompile<CR>:VimtexView<CR>
" map <F9> :VimtexCompile<CR>
map <F7> :AutoSaveToggle<CR>
nnoremap <F10> :set paste<CR>"+p:set nopaste<CR>
map <F11> :LivedownToggle<CR>
" }}} function keys "
map <S-Enter> O<ESC>
@ -247,13 +255,15 @@ nnoremap <leader>f q/p<CR>
" find merge conflicts
nnoremap <leader>fc /[<>=\|]\{7\}<CR>
" reload folds
nnoremap <leader>ff :set foldmethod=marker<CR> zM
nnoremap <leader>fmi :set foldmethod=indent<CR> zM
nnoremap <leader>fmm :set foldmethod=marker<CR> zM
" add marker foldmethod modeline
nnoremap <leader>fi :YcmCompleter FixIt<CR>
" find copied text
nnoremap <leader>ft /TODO<CR>
nnoremap <leader>g :YcmCompleter GoTo<CR>
" vimdiff split
nnoremap <leader>gd :Gvdiff<CR>
nnoremap <leader>gd :Gvdiff HEAD
" toggle search highlighting
nnoremap <leader>h :set hlsearch! hlsearch?<CR>
" help
@ -297,6 +307,7 @@ nnoremap <leader>so q:i.,$sort<CR>
nnoremap <leader>sol q:i.,.+sort<ESC>Fsi
" set syntax to shell (for dotfiles)
nnoremap <leader>sys :set syn=sh<CR>
vnoremap <leader>t :!tac<CR>
" open vimrc in vertical split
nnoremap <leader>vv :vsp ~/.vimrc<CR>
" format current line

Loading…
Cancel
Save