From 362fdd40156422779f51d5b109ec41164d67b1cf Mon Sep 17 00:00:00 2001 From: shmibs Date: Wed, 16 Jul 2014 21:12:18 -0700 Subject: added bytes to human readable function now i need to make it compatible with bash so it can be used to replace annoying conky stuff in my panel! --- .config/herbstluftwm/panel.sh | 18 +++++++++++++++++- .vimrc | 9 +++++++++ .zshrc | 19 +++++++++++++++++-- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/.config/herbstluftwm/panel.sh b/.config/herbstluftwm/panel.sh index 6417ebf..b3ff75b 100755 --- a/.config/herbstluftwm/panel.sh +++ b/.config/herbstluftwm/panel.sh @@ -45,6 +45,22 @@ hc pad $monitor $bheight # functions for retrieving and processing data # upon events +# bytes to human readable, cropped to 4 chars wide +#b2hc() { +# suffixes=( 'B' 'K' 'M' 'G' 'T' 'P' 'E' 'Z' 'Y' ) +# sindex=0 +# val=$1 +# [[ -z $(echo $1 | grep "^[0-9]*$") ]] && read val +# +# while [[ $(echo $val / 1024 | bc) -ne 0 ]]; do +# val=$(echo "scale=2; $val / 1024" | bc) +# let sindex=sindex+1 +# done +# +# val=$(echo $val | sed +# echo "${val}${suffixes[$sindex]}" +#} + update_taglist() { echo -n "%{l}%{B${bg_normal} F${fg_normal} U${fg_normal}}" hc tag_status | tr '\t' '\n' | sed \ @@ -132,7 +148,7 @@ get_date() { get_when() { { while true; do - if [[ "$(when --future=1 | sed '1,2d')" == "" ]]; then + if [[ "$(when --future=2 | sed '1,2d')" == "" ]]; then echo -e 'when\t0' else echo -e 'when\t1' diff --git a/.vimrc b/.vimrc index d5cd54f..77d64b8 100644 --- a/.vimrc +++ b/.vimrc @@ -27,6 +27,8 @@ nnoremap :buffers:b nnoremap :tabn nnoremap :tabp nnoremap sT +nnoremap :tabm +1 +nnoremap :tabm -1 "insert lines below nnoremap ++ == @@ -74,6 +76,7 @@ autocmd FileType cpp call Settings_cpp() autocmd FileType tex call Settings_tex() autocmd FileType haskell call Settings_haskell() autocmd FileType make call Settings_script() +autocmd FileType matlab call Settings_matlab() autocmd FileType perl call Settings_script() autocmd FileType python call Settings_script() autocmd FileType sh call Settings_script() @@ -111,6 +114,12 @@ function! Settings_haskell() nnoremap -- O-- endfunction +function! Settings_matlab() + "settings + "mappings + nnoremap -- O% +endfunction + function! Settings_script() "settings setlocal shiftwidth=4 diff --git a/.zshrc b/.zshrc index 4e14600..d5b07f5 100644 --- a/.zshrc +++ b/.zshrc @@ -72,15 +72,30 @@ alias diff='colordiff' alias less='less -R' alias latex='latex -output-format=pdf' -alias vmount='udevil mount' -alias vumount='udevil umount' alias def='sdcv' +alias ssh-socks='ssh -C2qTnN -D 9853 shmibbles.me' alias thesaurus='aiksaurus' +alias vmount='udevil mount' +alias vumount='udevil umount' export EDITOR="vim" export PAGER="less -R" ################## FUNCTIONS ################## +b2h() { + suffixes=( 'B' 'K' 'M' 'G' 'T' 'P' 'E' 'Z' 'Y' ) + sindex=1 + val=$1 + [[ -z $(echo $1 | grep "^[0-9]*$") ]] && read val + + while [[ $(echo $val / 1024 | bc) -ne 0 ]]; do + val=$(echo "scale=2; $val / 1024" | bc) + let sindex=sindex+1 + done + + echo "${val}${suffixes[$sindex]}" +} + send() { if [ "$1" ]; then scp $@ shmibbles.me:/srv/http/tmp/ -- cgit v1.2.3