Browse Source

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

- switch from pacman to yay
  - update packages
- apparent size du
red-hat-laptop
Kevin Mok 5 years ago
parent
commit
8e856eb64e
Signed by: Kevin-Mok GPG Key ID: AEA75288DC135CF5
  1. 62
      aliases/key_aliases
  2. 43
      fish/.config/fish/config.fish
  3. 5
      fish/.config/fish/functions/369/a4/block-to-line.fish
  4. 12
      fish/.config/fish/functions/369/a4/hex.fish
  5. 29
      fish/.config/fish/functions/369/a4/run-a4.fish
  6. 4
      fish/.config/fish/functions/grep-aliases.fish
  7. 3
      fish/.config/fish/functions/revert-e3-json.fish
  8. 8
      i3/.config/i3/config
  9. 9
      ranger/.config/ranger/rc.conf
  10. 3
      txt/exclude-dirs-backup.txt
  11. 5
      txt/key_dirs.txt
  12. 11
      txt/nzxt-aur.txt
  13. 13
      txt/nzxt-pkgs.txt
  14. 79
      vim/.vimrc
  15. 1
      zathura/.config/zathura/zathurarc

62
aliases/key_aliases

@ -9,8 +9,8 @@ fi "fish"
# reload urxvt
ru "xrdb ~/.Xresources"
# list file sizes in megabytes with depth 1
duh "sudo du -d 1 -ah | sort -hr"
dum "sudo du -d 1 -am | sort -hr"
duh "sudo du -d 1 -h --apparent-size | sort -hr"
dum "sudo du -d 1 -m --apparent-size | sort -hr"
m "man"
tl "tldr"
@ -102,38 +102,45 @@ vlh "alsamixer -c 2"
# pacman {{{ #
pc "sudo pacman -S"
pcq "sudo pacman -Qi"
pcr "sudo pacman -Rns"
pcud "sudo pacman -Sy"
pcug "sudo pacman -Syu"
xpc "pacman -Qqne > ~/linux-config/txt/nzxt-pkgs.txt && pacman -Qqme > ~/linux-config/txt/nzxt-aur.txt "
# pc "sudo pacman -S"
# pcq "sudo pacman -Qi"
# pcr "sudo pacman -Rns"
# pcud "sudo pacman -Sy"
# pcug "sudo pacman -Syu"
# xpc "pacman -Qqne > ~/linux-config/txt/nzxt-pkgs.txt && pacman -Qqme > ~/linux-config/txt/nzxt-aur.txt "
# tri "trizen -S --noconfirm"
tri "trizen -S --noedit"
# install
ya "yay -S --answerdiff=N --answeredit=N"
# info
yaq "yay -Qi"
# remove
yar "yay -Rns"
# sync
yaud "yay -Sy"
# sync and update
yaug "yay -Syu"
# export packages
xya "yay -Qqne > ~/linux-config/txt/nzxt-pkgs.txt && yay -Qqme > ~/linux-config/txt/nzxt-aur.txt "
# }}} pacman #
py "python"
pipi "sudo pip install"
# internet
pgo "ping -c 3 8.8.8.8"
pg "ping -c 3 -W 1 8.8.8.8"
dh "sudo dhcpcd"
kdh "sudo killall dhcpcd"
rdh "sudo killall dhcpcd && sudo dhcpcd"
id "identify"
# }}} system #
# config files {{{ #
rf "source ~/.config/fish/config.fish"
srf "sync-shortcuts && source ~/.config/fish/config.fish"
rz "source ~/linux-config/aliases/zsh_aliases"
# rz "source ~/linux-config/aliases/zsh_aliases"
pipes "pipes.sh -t 3"
# }}} config files #
# }}} system #
# applications {{{ #
@ -148,11 +155,13 @@ gpe "gpg --encrypt --recipient"
htc "htop -s PERCENT_CPU"
htm "htop -s PERCENT_MEM"
kd "killall Discord && killall Discord"
kt "killall thunderbird"
mp "mpv --volume=50"
mra "man ranger"
n "nvim"
nd "node"
p3 "python3"
pipes "pipes.sh -t 3"
py "python"
r "ranger"
rx "redshift -x"
@ -198,6 +207,7 @@ wrw "watson report"
wre "watson restart"
ws "watson status && watson stop"
wse "watson stop && watson edit"
wsc "watson cancel"
wsl "watson stop && watson log --day"
wt "watson status"
@ -272,6 +282,7 @@ gcam "git add -A . && git commit --amend -S"
psgi "git add . && git commit -m 'Update' -S && git push"
gps "git push"
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"
@ -321,10 +332,9 @@ rgt "rg TODO"
# svscs "f $spv_dir/src/static/scss"
# svcss "f $spv_dir/src/spotifyvis/static/scss"
# start spv server from dir
pg "sudo systemctl start postgresql.service && systemctl status postgresql.service"
# pg "sudo systemctl start postgresql.service && systemctl status postgresql.service"
ssv "bash ../bin/activate && python manage.py runserver"
# start spv server outside dir
sssv "sv && ssv"
# open spv db in psql
spvdb "psql -d spotifyvis -U django"
mig "python manage.py makemigrations && python manage.py migrate --run-syncdb && ssv"
@ -372,12 +382,16 @@ rt "python ~/coding/rt-scraper/rt-scraper.py"
# 369 {{{ #
ssc "ssh mokkar@teach.cs.utoronto.ca"
ma "printf '\033c' && bear make"
mc "bear make clean"
mca "bear make clean && printf '\033c' && bear make"
rmc "rm compile_commands.json"
rms "rm swapfile.*"
wl6 "watson log --all --project=369 --tag=a3"
wr6 "watson report --all --project=369 --tag=a3"
wl6 "watson log --all --project=369 --tag=a4"
wr6 "watson report --all --project=369 --tag=a4"
# a2 {{{ #
@ -401,8 +415,8 @@ hl "valgrind --tool=helgrind ./carsim light 10 20"
# 309
0ht "cd ~/school/309-proj && python3 -m http.server"
wl0 "watson log --all --project=309 --tag=project"
wr0 "watson report --all --project=309 --tag=project"
wl0 "watson log --all --project=309 --tag=e3"
wr0 "watson report --all --project=309 --tag=e3"
e3t "node test-app.js"

43
fish/.config/fish/config.fish

@ -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 #

5
fish/.config/fish/functions/369/a4/block-to-line.fish

@ -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

12
fish/.config/fish/functions/369/a4/hex.fish

@ -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

29
fish/.config/fish/functions/369/a4/run-a4.fish

@ -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

4
fish/.config/fish/functions/grep-aliases.fish

@ -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

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

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

8
i3/.config/i3/config

@ -41,16 +41,17 @@ bindsym Mod4+h exec echo 'kevin.mok@live.ca' | xclip -selection clipboard
bindsym Mod4+$mod+m exec pass -c uoft/markus
bindsym Mod4+n exec urxvt -e nvim
bindsym Mod4+o exec xclip -selection clipboard ~/.password-store/social/gmail
bindsym Mod4+$mod+o exec xset dpms force off
# bindsym Mod4+p workspace $ws4; exec pgadmin3
# bindsym Mod4+p exec pycharm
bindsym Mod4+p exec passmenu
# bindsym Mod4+$mod+p exec notify-send "ping" "$(ping -c 3 -W 1 8.8.8.8)"
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 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+$mod+t exec xclip -selection clipboard ~/.password-store/social/trapbot
bindsym Mod4+u exec echo 'kevin.mok@mail.utoronto.ca' | xclip -selection clipboard
bindsym Mod4+$mod+u exec pass -c uoft/acorn
bindsym Mod4+w exec notify-send "watson status" "$(watson status)"
@ -231,7 +232,8 @@ set $ws5 "5 "
workspace $ws5 output $samsung
assign [class="Steam"] $ws5
bindsym $mod+F5 workspace $ws5; exec $browser
bindsym Mod4+g workspace $ws5; layout stacking; exec urxvt -e steam
# bindsym Mod4+g workspace $ws5; layout stacking; exec urxvt -e steam
bindsym Mod4+t workspace $ws5; exec thunderbird
set $ws6 "6 "
workspace $ws6 output $samsung

9
ranger/.config/ranger/rc.conf

@ -668,11 +668,14 @@ set preview_images_method w3m
# }}} image preview #
# custom {{{ #
# editing ranger config
map R chain shell nvim -p ~/.config/ranger/rc.conf %rangerdir/config/rc.conf; source ~/.config/ranger/rc.conf
map rr source ~/.config/ranger/rc.conf
# backgrounds
# backgrounds {{{ #
map w shell /usr/bin/wal -i %f
map bde shell mv %f dim/editing
map bdn shell mv %f dim/non-editing
@ -681,6 +684,8 @@ map bbn shell mv %f bright/non-editing
map be shell mv %f editing
map bn shell mv %f non-editing
# }}} backgrounds #
# bulk rename
map cw eval fm.execute_console("bulkrename") if fm.thisdir.marked_items else fm.open_console("rename ")
@ -698,3 +703,5 @@ map dg shell dragon-drag-and-drop -a -x %p
# a plugin that adds file glyphs / icon support to Ranger:
# https://github.com/alexanderjeurissen/ranger_devicons
default_linemode devicons
# }}} custom #

3
txt/exclude-dirs-backup.txt

@ -1,3 +1,6 @@
/home/kevin/.android
/home/kevin/.AndroidStudio3.3
/home/kevin/Android
/home/kevin/.cache
/home/kevin/.local/share/Steam
/lost+found

5
txt/key_dirs.txt

@ -53,8 +53,11 @@ e3 /home/kevin/school/309/e3
# 369
6 /home/kevin/school/369
6l /home/kevin/school/369/notes/lectures
6f /home/kevin/linux-config/fish/.config/fish/functions/369/a3
a3 /home/kevin/school/369/a3/a3
a4d /home/kevin/school/369/a4/a4
a43 /home/kevin/school/369/a4-3/fs3
hp /home/kevin/school/hps
lt /home/kevin/school/latex-notes

11
txt/nzxt-aur.txt

@ -1,14 +1,18 @@
android-studio
bear
browserpass
chromium-widevine
cliqz
cliqz-bin
discord
dragon-drag-and-drop-git
ffcast
flashplugin-focusfix
htop-vim-git
i3blocks-git
linux-kevin
linux-kevin-headers
linux-nzxt
linux-nzxt-headers
lua-cjson
nx3-all
peaclock
@ -26,11 +30,11 @@ systemd-numlockontty
texlive-local-algorithmicx
texlive-local-algorithms
texlive-local-enumitem
texlive-local-hyperref
texlive-local-ifmtarg
texlive-local-multirow
texlive-local-numprint
texlive-local-pgfplots
texlive-local-siunitx
texlive-local-tkz-base
texlive-local-tkz-euclide
texlive-local-xifthen
@ -38,8 +42,9 @@ texlive-localmanager-git
tor-browser
trizen
ttf-emojione
vidir
watson
weechat-vimode-git
wego
xboxdrv
yad
yay

13
txt/nzxt-pkgs.txt

@ -30,7 +30,6 @@ e2fsprogs
electrum
encfs
evince
evolution
fakeroot
fd
feh
@ -39,6 +38,7 @@ filesystem
findutils
firefox
fish
flashplugin
flex
fzf
gawk
@ -52,6 +52,8 @@ glibc
grep
grub
gzip
hexyl
highlight
hugo
i3-gaps
i3status
@ -72,7 +74,6 @@ logrotate
lolcat
lsd
lsof
lutris
lvm2
lxappearance
make
@ -82,6 +83,7 @@ mdadm
meld
mpv
nano
ncdu
neofetch
neomutt
neovim
@ -117,6 +119,7 @@ python-dbus
python-pip
python-pywal
python-setuptools
qemu
qrencode
ranger
redshift
@ -143,9 +146,12 @@ tar
texinfo
texlive-core
the_silver_searcher
thunderbird
tidy
time
tmux
tor
transmission-cli
transmission-gtk
ttf-dejavu
ttf-font-awesome
@ -158,10 +164,8 @@ valgrind
vi
vim
virtualbox
vlc
w3m
which
wine
wireless_tools
wkhtmltopdf
wpa_actiond
@ -187,7 +191,6 @@ xfsprogs
xorg-bdftopcf
xorg-iceauth
xorg-luit
xorg-mkfontdir
xorg-mkfontscale
xorg-server
xorg-sessreg

79
vim/.vimrc

@ -1,23 +1,36 @@
" set x=y {{{ "
au BufWinEnter * set relativenumber
" set background=dark
set encoding=utf-8
set background=light
" set t_Co=256
filetype plugin on
syntax on
set tabstop=4
set tw=80
set linebreak
" set colorcolumn=80
set shiftwidth=4
set autoindent
" set mouse=c
set mouse=a
set autoread
set background=dark
" set colorcolumn=80
set clipboard+=unnamedplus
set foldmethod=marker
set diffopt=filler,context:3
set encoding=utf-8
set expandtab
" set foldmethod=indent
set foldmethod=marker
set hlsearch
set linebreak
set linespace=5
set mouse=a
" set mouse=c
" set noswapfile
set relativenumber
set shiftwidth=4
set tabstop=4
" set t_Co=256
" set timeoutlen=500
set timeoutlen=350
set tw=80
set updatetime=1000
autocmd VimResized * wincmd =
filetype plugin on
filetype indent on
syntax on
au CursorHold,CursorHoldI * checktime
" cursor indicator {{{ "
" set listchars=tab:\|\
@ -26,25 +39,14 @@ set linespace=5
" set cursorline
" }}} cursor indicator "
set diffopt=filler,context:3
" set timeoutlen=500
set timeoutlen=350
set hlsearch
" set noswapfile
" let maplocalleader="-"
let maplocalleader="\\"
" }}} set x=y "
" commands for file types {{{ "
autocmd VimResized * wincmd =
autocmd BufNewFile,BufRead .* set syntax=sh
filetype plugin on
filetype indent on
autocmd FileType *css,htmldjango,html,javascript,markdown,tex,yaml set tabstop=2 shiftwidth=2 expandtab
autocmd BufNewFile,BufRead *.txt set tabstop=2 shiftwidth=2 expandtab
autocmd BufNewFile,BufRead *.md set filetype=markdown
autocmd FileType *css,htmldjango,html,javascript,markdown,tex,text,yaml set tabstop=2 shiftwidth=2
" autocmd BufNewFile,BufRead *.md set filetype=markdown
autocmd Filetype markdown set textwidth=0
" autocmd Filetype html set foldmarker=0
@ -55,7 +57,6 @@ 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 {{{ "
@ -81,7 +82,7 @@ autocmd BufNewFile,BufRead key_* map <F1> :silent !sync-shortcuts<CR>
" }}} commands for specific files "
" vim-plug {{{ "
" vim-plug {{{
" plug auto-install
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
@ -200,8 +201,13 @@ Plug 'PotatoesMaster/i3-vim-syntax'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'terryma/vim-multiple-cursors'
" let g:multi_cursor_select_all_word_key='<C-a>'
let g:multi_cursor_exit_from_visual_mode=0
let g:multi_cursor_exit_from_insert_mode=0
Plug 'dag/vim-fish'
Plug 'shime/vim-livedown'
Plug 'tpope/vim-fugitive'
" auto reload file
Plug 'djoshea/vim-autoread'
call plug#end()
@ -218,12 +224,16 @@ map <F4> :xa<CR>
map <F5> :q!<CR>
map <F6> :qa!<CR>
map <F7> :AutoSaveToggle<CR>
" reload file
nnoremap <F9> :e<CR>
nnoremap <F10> :set paste<CR>"+p:set nopaste<CR>
nnoremap <F11> :set paste<CR>"*p:set nopaste<CR>
" }}} function keys "
map <S-Enter> O<ESC>
" swap text visually
vnoremap <C-P> <Esc>`.``gvP``P
ino <C-A> <C-O>yiW<End>=<C-R>=<C-R>0<CR>
" splits {{{ "
nnoremap <C-Down> <C-W><C-J>
@ -237,6 +247,7 @@ nnoremap <C-w> <C-W>|
" leader mappings {{{ "
let mapleader="\<Space>"
" let maplocalleader="-"
" find alias
nnoremap <leader>a /^ <Left>
@ -285,10 +296,8 @@ nnoremap <leader>plc :PlugClean<CR>
nnoremap <leader>plu :PlugUpdate<CR>
" don't break lines
nnoremap <leader>py :set tw=0<CR>
" reload file
nnoremap <leader>r :e<CR>
" replace in next x lines
nnoremap <leader>re q:i.,.+s///g<ESC>Fsi
nnoremap <leader>r q:i.,.+s///g<ESC>Fsi
" replace in line
nnoremap <leader>rl q:i.s///g<left><left><left>
" replace in visual selection
@ -329,6 +338,8 @@ nnoremap <leader>z za
" Local Mappings {{{ "
let maplocalleader="\\"
" tex {{{ "
autocmd Filetype tex inoremap <localleader>bt \bowtie
@ -367,6 +378,8 @@ autocmd Filetype tex inoremap <localleader>tx $t(x)$
" }}} tex "
autocmd Filetype c inoremap <localleader>uc unsigned char
autocmd Filetype fish inoremap <localleader>1 $argv[1]
autocmd Filetype fish inoremap <localleader>2 $argv[2]

1
zathura/.config/zathura/zathurarc

@ -1,3 +1,4 @@
set recolor true
set recolor-darkcolor "#dcdccc"
set recolor-lightcolor "#1f1f1f"
set selection-clipboard clipboard
Loading…
Cancel
Save