Permalink
Browse files

First batch of files

  • Loading branch information...
1 parent d83b8bc commit 5b5f24ac73c28ffaae26b0d457e364eccacf4ed7 @Chris2048 committed Feb 17, 2013
Showing with 1,088 additions and 0 deletions.
  1. +42 −0 .tmux.conf
  2. +1 −0 README.md
  3. +27 −0 bin/bash-script-manager.sh
  4. +27 −0 bin/colortable
  5. +4 −0 bin/cpuusage
  6. +121 −0 bin/exad.py
  7. +4 −0 bin/gcaladd
  8. +4 −0 bin/makebin
  9. +13 −0 bin/messdir
  10. +8 −0 bin/netusage
  11. +17 −0 bin/retq
  12. +1 −0 bin/rscp
  13. +1 −0 bin/rsmv
  14. +28 −0 bin/scr-ssh
  15. +10 −0 bin/stmux
  16. +88 −0 bin/tm.backup.sh
  17. +60 −0 bin/top10.py
  18. +35 −0 bin/urlencode.sed
  19. +541 −0 subtle.rb
  20. +56 −0 xinitrc
View
@@ -0,0 +1,42 @@
+unbind %
+bind | split-window -h
+bind - split-window -v
+set -g prefix C-x
+#bind C-b send-prefix
+bind R neww 'ssh root@ROUTER'
+bind d kill-window
+#bind -n C-RET next-window
+bind j previous-window
+bind k next-window
+bind r source-file ~/.tmux.conf
+bind TAB rotatew
+# act like vim
+setw -g mode-keys emacs
+#bind-key -r C-h select-window -t :-
+#bind-key -r C-l select-window -t :+
+# Commands
+bind-key S command-prompt -p "ssh: " "new-window -n %1 'ssh %1'"
+set -g history-limit 10000
+set -g status-bg black
+set -g status-fg white
+set -g status-left-length 30
+set -g default-shell /bin/zsh
+set -g default-terminal 'screen-256color'
+setw -g aggressive-resize on
+setw -g monitor-activity on
+#setw -g automatic-rename on
+setw -g alternate-screen on
+setw -g utf8 on
+set -g set-titles on
+set -g set-titles-string '#T'
+set -g status-right ''
+set -g status-left ' #4H '
+
View
@@ -0,0 +1 @@
+Place for misc dotfiles, and useful system files.
View
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+if [[ $# != 2 ]] ;then
+ echo "Wrong number of parameters."
+ exit
+fi
+
+case "$1" in
+ a)
+ if [ -z "${EDITOR+xxx}" ]; then
+ echo 'Variable $EDITOR not declared.'
+ else
+ echo '#!/bin/bash'>"$HOME/bin/$2"
+ eval "$EDITOR $HOME/bin/$2" && chmod +x "$HOME/bin/$2"
+ fi;;
+
+ e)
+ if [ -z "${EDITOR+xxx}" ]; then
+ echo 'Variable $EDITOR not declared.'
+ else
+ eval "$EDITOR $HOME/bin/$2"
+ fi;;
+
+ r) rm $HOME/bin/$2 ;;
+
+ *) echo "$1 - argument unknown" ;;
+esac
View
@@ -0,0 +1,27 @@
+#!/bin/bash
+#
+# This file echoes a bunch of color codes to the
+# terminal to demonstrate what's available. Each
+# line is the color code of one forground color,
+# out of 17 (default + 16 escapes), followed by a
+# test use of that color on all nine background
+# colors (default + 8 escapes).
+#
+
+T='gYw' # The test text
+
+echo -e "\n 40m 41m 42m 43m\
+ 44m 45m 46m 47m";
+
+for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \
+ '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \
+ ' 36m' '1;36m' ' 37m' '1;37m';
+ do FG=${FGs// /}
+ echo -en " $FGs \033[$FG $T "
+ for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
+ do echo -en "$EINS \033[$FG\033[$BG $T \033[0m";
+ done
+ echo;
+done
+echo
+
View
@@ -0,0 +1,4 @@
+#!/usr/bin/python2.7
+
+from psutil import *
+print("cpu: %3.0d%%" % (cpu_percent(interval=2),))
View
@@ -0,0 +1,121 @@
+#! python
+# http://infohost.nmt.edu/tcc/help/lang/python/sysprog.html
+# http://docs.python.org/library/stat.html
+# http://effbot.org/zone/python-fileinfo.htm
+
+import sys; sys.path.append('') # where are repos?
+
+from os.path import isdir
+from Piping import Pipe
+from Piping.iterpipe import ShellPipe
+from Piping.commands import *
+
+cal = ShellPipe('cal')
+
+tfdir = '' # tfdir
+
+# from http://jeetworks.com/node/62
+class cached_property(object):
+ """
+ Lazy-loading read/write property descriptor.
+ Value is stored locally in descriptor object. If value is not set when
+ accessed, value is computed using given function. Value can be cleared
+ by calling 'del'.
+ """
+
+ def __init__(self, func):
+ self._func = func
+ self._values = {}
+ self.__name__ = func.__name__
+ self.__doc__ = func.__doc__
+
+ def __get__(self, obj, obj_class):
+ if obj is None:
+ return obj
+ if obj not in self._values \
+ or self._values[obj] is None:
+ self._values[obj] = self._func(obj)
+ return self._values[obj]
+
+ def __set__(self, obj, value):
+ self._values[obj] = value
+
+ def __delete__(self, obj):
+ if self.__name__ in obj.__dict__:
+ del obj.__dict__[self.__name__]
+ self._values[obj] = None
+
+class PipingFile():
+ def __init__(self, *pathstr):
+ if len(pathstr) == 1:
+ self.basepath, self.name = split(pathstr)
+ else:
+ (self.basepath, self.name) = pathstr
+ @cached_property
+ def isdir(self):
+ return isdir(self.fullpath)
+ @cached_property
+ def fullpath(self):
+ return join(self.basepath, self.name)
+ @cached_property
+ def filetype(self):
+ return (None |ShellPipe("file {}")(self.fullpath)).next().split(': ',1)[1]
+ @cached_property
+ def stats(self):
+ pass
+ # iterpipes doesn't fully shell escape?
+ def __repr__(self):
+ return self.name
+ # add other stats.
+
+from os import listdir
+from os.path import join, split
+@Pipe
+def lsdirs(inp):
+ if type(inp) in (str,unicode):
+ inp = (inp,)
+ for d in inp:
+ for i in listdir(d):
+ yield PipingFile(d, i)
+
+#thedirs = (tfdir,) | lsdirs | where(isdir) | a(tuple)
+# where attr? pass pipes to where?
+
+thefiles = (tfdir,) | lsdirs
+thedirs = thefiles | where(lambda x: x.isdir)
+thedirs | each(lambda x: x.filetype) | ppout
+
+
+
+rars = []
+smalldirs = []
+
+# for d in thedirs:
+# ld = listdir(d)
+# thefiles = \
+# ( ftype(join(d,l)) | select(lambda x: tuple(x.split(': ',1)))
+# for l in ld if len(ld) < 30 ) \
+# | chain | as_list
+# if thefiles and len(thefiles) < 4:
+# smalldirs.append(thefiles)
+# rars += \
+# thefiles | where(lambda (x,y): y.startswith('RAR')) \
+# | select(lambda (x,y): x) | as_list
+
+
+
+#thefiles | where(lambda (x,y): y.find('MPEG') != -1) | ppout
+
+#thedirs = thefiles | where(lambda (x,y): y == 'directory') | as_tuple
+
+#for d in thedirs | select(lambda (x,y): tuple(glob(x +'/*'))):
+# d | where(lambda x: x.endswith('rar')) | ppout
+
+
+#thebuzz = thefiles | each(ShellPipe('file {}'))
+# each for python functions (strip) and for shellpipes (file)
+
+#print [ i for i in thebuzz]
+
+#take dir
+#aunpack $1/*.rar && rm -r $1
View
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+DESC="${@:2}"
+exec google calendar add --cal thetvdb --date "$1" "$DESC" >/dev/null 2>&1
View
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+sudo chown -R chris.users ~chris/bin
+sudo chmod u+x ~chris/bin/*
View
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+MESSDIR="$HOME/.mess"
+DATENUM=`date +"%V"`
+
+if [ ! -e $MESSDIR/$DATENUM ]; then
+ find $MESSDIR -maxdepth 1 -type d -empty -exec rmdir {} \;
+ mkdir $MESSDIR/$DATENUM
+ cp -P "$HOME/mess" $MESSDIR/$DATENUM/PREV
+ ln -fns $MESSDIR/$DATENUM "$HOME/mess"
+fi && cd "$HOME/mess"
+
+echo $PWD
View
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+while true
+do
+vnstat -tr 2 \
+| tr -d '\n' \
+| sed -e 's/^.*rx\ *\([\.0-9]*\)\ .*tx\ *\([\.0-9]*\)\ .*$/\1 dn \2 up\n/'
+done
View
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+echo "Press any key to run $1..."
+
+while true; do
+ read -sn 1 reply
+ case $reply in
+ 'q' )
+ break ;;
+ * )
+ $@ ;;
+ esac
+ sleep 1s; echo "Press any key to rerun $1..."
+done
+
+exec bash
+exit 1
View
@@ -0,0 +1 @@
+exec rsync --partial --progress --append --rsh=ssh -r -h $@
View
@@ -0,0 +1 @@
+exec rsync --partial --progress --append --rsh=ssh -r -h --remove-sent-files "$@"
View
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+
+system("clear");
+
+use Term::ANSIColor qw(:constants);
+$Term::ANSIColor::AUTORESET = 1;
+
+$pt = `ps -Ao cmd=|grep -E '^ssh'`;
+@pt = split(/\n/, $pt);
+foreach $i (@pt) {
+@i = split(/\s/, $i);
+push(@connected, $i[1]) if $#i == 1;
+}
+
+@servs = ();
+
+foreach $i (@servs) {
+ if (grep {$_ eq $i} @connected) {
+ print BOLD BLUE ++$n, " $i \n";
+ } else { print ++$n, " $i \n"; }
+}
+
+print "\nmake choice: ";
+$c = <>;
+system("clear");
+exec "TERM='screen-256color' ssh $servs[$c-1]";
+
+#var=host ;while ! nc -zw 1 $var 22;do sleep 1; done ; ssh user@$var
View
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+if ! tmux has -t default; then
+ tmux new -d -s default
+ exec tmux attach -t default
+else
+ exec tmux attach -t default
+fi
+
+exit 1
Oops, something went wrong.

0 comments on commit 5b5f24a

Please sign in to comment.