aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshmibs <shmibs@gmail.com>2014-07-16 21:12:18 -0700
committershmibs <shmibs@gmail.com>2014-07-16 21:12:18 -0700
commit362fdd40156422779f51d5b109ec41164d67b1cf (patch)
tree0e117559d95779f531b59affdf8d2ccaaff4675c
parenteffba62a0758a13cfdc288d1c8543c74634fdac2 (diff)
downloaddotfiles-362fdd40156422779f51d5b109ec41164d67b1cf.tar.gz
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!
-rwxr-xr-x.config/herbstluftwm/panel.sh18
-rw-r--r--.vimrc9
-rw-r--r--.zshrc19
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 <C-g> :buffers<CR>:b<Space>
nnoremap <C-n> :tabn<CR>
nnoremap <C-p> :tabp<CR>
nnoremap <C-t> <C-w>s<C-w>T
+nnoremap <C-w><C-n> :tabm +1<CR>
+nnoremap <C-w><C-p> :tabm -1<CR>
"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--<Space>
endfunction
+function! Settings_matlab()
+ "settings
+ "mappings
+ nnoremap -- O%<Space>
+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/