summaryrefslogtreecommitdiffstats
authorRaghavendra D Prabhu <[email protected]>2011-03-27 10:19:56 (GMT)
committer Raghavendra D Prabhu <[email protected]>2011-03-27 10:19:56 (GMT)
commite4d030c21f2094baeb8c6f6fa0ff1cce2069b1c1 (patch) (side-by-side diff)
treebcc7d839d41c31fcc794d26cee3cd9c1de968074
parenta4a45af197578fbe06e6d81f4c479776d732272b (diff)
downloadScripts-e4d030c21f2094baeb8c6f6fa0ff1cce2069b1c1.zip
Scripts-e4d030c21f2094baeb8c6f6fa0ff1cce2069b1c1.tar.gz
Scripts-e4d030c21f2094baeb8c6f6fa0ff1cce2069b1c1.tar.bz2
Script updates
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xarchievm39
-rwxr-xr-xbldins4
-rwxr-xr-xdownload6
-rw-r--r--functions54
-rwxr-xr-xgitprompt7
-rwxr-xr-xmailboxes4
-rwxr-xr-xmplayer6
-rwxr-xr-xtmux-url3
-rwxr-xr-xwsync49
9 files changed, 98 insertions, 74 deletions
diff --git a/archievm b/archievm
index 4cabb0b..ff95900 100755
--- a/archievm
+++ b/archievm
@@ -1,16 +1,19 @@
#!/bin/zsh
+# Virtio somehow broken
[[ ! $(whoami) == 'root' ]] && exit 1
+modprobe kvm kvm_intel
debugk=0
nographic=1
huge=0
-test=1
+test=0
runas="raghavendra"
DIR="/home/raghavendra/Arch/qemu"
bzImage="$DIR/kvmImage"
-FILE="/media/Inkq/Virt/Archie.img"
-
+image="/media/Inkq/Virt/Archie.img"
+soutput=1
+#append="root=/dev/vda3"
typeset -A args
args=(d debugk n nographic g huge I bzImage t test)
@@ -43,8 +46,14 @@ EARGS="[email protected]"
[[ ! -d /mnt-qemu ]] && mkdir -p /mnt-qemu
+[[ $nographic == 0 ]] && soutput=0
+
if [[ $debugk == 1 ]];then
- external=" -kernel $bzImage -initrd /boot/kernel26.img -append root=/dev/vda3 "
+ if [[ $soutput == 1 ]];then
+ external=" -kernel $bzImage -initrd /boot/kernel26-.img -append \"root=/dev/vda3 console=ttyS0 earlyprintk=serial,ttyS0\" -serial file:$DIR/console.log "
+ else
+ external=" -kernel $bzImage -initrd /boot/kernel26-.img -append \"root=/dev/vda3\" "
+ fi
fi
if [[ $huge == 1 ]];then
@@ -54,30 +63,34 @@ if [[ $huge == 1 ]];then
fi
if [[ $nographic == 1 ]];then
- graph=" -daemonize -nographic -serial file:$DIR/console.log"
+ graph=" -daemonize -nographic "
else
graph=" -vga std -sdl -no-frame"
fi
if [[ $test == 1 ]];then
- snap=" -snapshot -drive file=$FILE,if=virtio "
+ snap=" -snapshot -drive file=$image,if=virtio "
else
- snap=" -drive file=$FILE,if=virtio,cache=writeback,boot=on -boot order=dc "
+ snap=" -drive file=$image,if=virtio,cache=writeback "
fi
-qemu-kvm -name Archie -enable-kvm -s -monitor unix:$DIR/archie.sock,server,nowait \
- -m 512 $hugearg $=snap -smp 2,cores=2,maxcpus=4 \
+ #-virtfs local,path=$DIR/module,security_model=passthrough,mount_tag=module \
+
+cmdline="qemu-kvm -name Archie -enable-kvm -s -monitor unix:$DIR/archie.sock,server,nowait \
+ -m 512 $hugearg $snap -smp 2,cores=2,maxcpus=4 \
-net nic,model=virtio,vlan=1 -net user,vlan=1,hostfwd=tcp:127.0.0.1:2222-:22 $=graph \
-virtfs local,path=$DIR/share,security_model=passthrough,mount_tag=share -balloon virtio \
- -virtfs local,path=$DIR/module,security_model=passthrough,mount_tag=module \
-virtfs local,path=/var/cache/pacman/pkg,security_model=passthrough,mount_tag=pacman \
- $=external -runas $runas $=EARGS \
- || exit 1
+ $external -runas $runas $=EARGS"
+#echo "$cmdline"
+#exit
+eval $=cmdline
echo 1 >| /sys/kernel/mm/ksm/run
echo "sudo -u $runas sshfs -p 2222 [email protected]:/ /mnt-qemu" | xclip -i
-rlwrap -pgreen socat - $DIR/archie.sock
+#rlwrap -pgreen socat - $DIR/archie.sock
+rlwrap socat - $DIR/archie.sock
#qemu-kvm -name Archie -enable-kvm -m 512 -snapshot -drive file=/media/Inkq/Virt/Archie.img,if=virtio -vga std -kernel ~/Arch/qemu/kvmImage -initrd /boot/kernel26.img -append root=/dev/vda3
#qemu-kvm -name Archie -enable-kvm -m 512 -snapshot -hda /media/Inkq/Virt/Archie.img -vga std -kernel ~/Arch/qemu/kvmImage -initrd /boot/kernel26-wye.img -append "root=/dev/sda3 console=ttyS0 earlyprintk=serial,ttyS0" -serial file:/tmp/x.log#
diff --git a/bldins b/bldins
index fd54bc3..34d1fb8 100755
--- a/bldins
+++ b/bldins
@@ -44,7 +44,7 @@ if [[ $install == 0 ]];then
#export BUILDCMD=" make $MAKEFLAGS bzImage "
#cp ~/config/kconfig/config.debug .config
- KCFLAGS=" -mtune=generic -O -pipe -ggdb3 "
+ KCFLAGS=" -mtune=generic -O -pipe "
BUILDCMD=" make $MAKEFLAGS bzImage "
#LDFLAGS_MODULE=""
unset INSTALL_MOD_STRIP
@@ -62,7 +62,7 @@ if [[ $install == 0 ]];then
echo "Building bzImage!"
#/usr/bin/time -p $=BUILDCMD | tee $LOGFILE || exit 1
- /usr/bin/time -p $=BUILDCMD | tee $LOGFILE || exit 1
+ (/usr/bin/time -p $=BUILDCMD || exit 1) | tee $LOGFILE
ver=${kernver[(ws:-:)-1]}
kernelname=${1:-$ver}
diff --git a/download b/download
index baea2d4..88e8392 100755
--- a/download
+++ b/download
@@ -4,10 +4,10 @@ URL="[email protected]"
if [[ $URL == *.torrent ]]
then
pidof -s rtorrent &>/dev/null || ~/bin/tux tnum rtorrent
- [[ $1 =~ ^http.* ]] && /usr/bin/wget --content-disposition -q $1 > ~/.rtorrent/watch/${1##*/} && echo "$URL ============ $(/usr/bin/aria2c --no-conf -S ~/.rtorrent/watch/${1##*/})===========$(date)" >> $histfile && exit
+ [[ $1 =~ ^http.* ]] && /usr/bin/wget --content-disposition -q $1 > ~/.rtorrent/watch/${1##*/} && echo "$URL ============ $(aria2c --no-conf -S ~/.rtorrent/watch/${1##*/})===========$(date)" >> $histfile && exit
cp $URL ~/.rtorrent/watch/
- notify-send "Torrent" "Download started for $(/usr/bin/aria2c --no-conf -S $URL | grep Name) "
- echo "$URL ============ $(/usr/bin/aria2c --no-conf -S $URL | grep Name) ====================$(date)" >> $histfile
+ notify-send "Torrent" "Download started for $(aria2c --no-conf -S $URL | grep Name) "
+ echo "$URL ============ $(aria2c --no-conf -S $URL | grep Name) ====================$(date)" >> $histfile
mv "$URL" ~/.torrents/
else
diff --git a/functions b/functions
index d5510da..26ead44 100644
--- a/functions
+++ b/functions
@@ -3,7 +3,7 @@ word="${@:-$(xclip -o)}"
if [[ ! -f $XDG_CACHE_HOME/pronounce/$word ]];then
wget -qO- $(wget -qO- "http://dictionary.reference.com/browse/$word" | grep 'soundUrl' | head -n 1 | sed 's|.*soundUrl=\([^&]*\)&.*|\1|' | sed 's/%3A/:/g;s/%2F/\//g') | tee $XDG_CACHE_HOME/pronounce/$word | /usr/bin/mplayer -really-quiet -cache 8192 -
else
- /usr/bin/mplayer $XDG_CACHE_HOME/pronounce/$word
+ /usr/bin/mplayer -really-quiet $XDG_CACHE_HOME/pronounce/$word
fi
}
@@ -44,7 +44,7 @@ curl -s http://bash.org/?random1|grep -oE "<p class=\"quote\">.*</p>.*</p>"|grep
function ifind(){
-find . -iname "*[email protected]*"
+ find . -iname "*[email protected]*"
}
mountole(){
@@ -127,15 +127,15 @@ function cscore()
}
function wpack(){
-pacman -Q | grep "[email protected]"
+ pacman -Q | grep "[email protected]"
}
function max(){
-~/bin/mplayeraux "[email protected]"
+ ~/bin/mplayeraux "[email protected]"
}
function rsize() {
-wget --spider "[email protected]" -o /tmp/wget_tmp; grep -i Length /tmp/wget_tmp; rm /tmp/wget_tmp
+ wget --spider "[email protected]" -o /tmp/wget_tmp; grep -i Length /tmp/wget_tmp; rm /tmp/wget_tmp
}
function buildabs()
@@ -149,7 +149,7 @@ function buildabs()
}
function vpdf(){
-pdftohtml -q -stdout -noframes "[email protected]" | /usr/bin/w3m -T text/html
+ pdftohtml -q -stdout -noframes "[email protected]" | /usr/bin/w3m -T text/html
}
function view()
@@ -230,7 +230,7 @@ define() {
fi
rm -f /tmp/define
echo ">=========================>"
- aiksaurus $1
+ caiksaurus $1 2>/dev/null
echo $1 >> ~/wordlist
return 0
}
@@ -377,7 +377,7 @@ fi
}
comcache(){
-export PATH="/usr/lib/ccache/bin/:$PATH"
+ export PATH="/usr/lib/ccache/bin/:$PATH"
}
ad2que(){
@@ -494,44 +494,6 @@ dlink(){
curl -s "[email protected]" | /usr/bin/w3m -dump -T text/html
}
-H-Glob() {
- echo -e "
- / directories
- . plain files
- @ symbolic links
- = sockets
- p named pipes (FIFOs)
- * executable plain files (0100)
- % device files (character or block special)
- %b block special files
- %c character special files
- r owner-readable files (0400)
- w owner-writable files (0200)
- x owner-executable files (0100)
- A group-readable files (0040)
- I group-writable files (0020)
- E group-executable files (0010)
- R world-readable files (0004)
- W world-writable files (0002)
- X world-executable files (0001)
- s setuid files (04000)
- S setgid files (02000)
- t files with the sticky bit (01000)
-
- print *(m-1) # Files modified up to a day ago
- print *(a1) # Files accessed a day ago
- print *(@) # Just symlinks
- print *(Lk+50) # Files bigger than 50 kilobytes
- print *(Lk-50) # Files smaller than 50 kilobytes
- print **/*.c # All *.c files recursively starting in \$PWD
- print **/*.c~file.c # Same as above, but excluding 'file.c'
- print (foo|bar).* # Files starting with 'foo' or 'bar'
- print *~*.* # All Files that do not contain a dot
- chmod 644 *(.^x) # make all plain non-executable files publically readable
- print -l *(.c|.h) # Lists *.c and *.h
- print **/*(g:users:) # Recursively match all files that are owned by group 'users'
- echo /proc/*/cwd(:h:t:s/self//) # Analogous to >ps ax | awk '{print $1}'<"
-}
#alias help-zshglob=H-Glob
function lsnew () {
if [[ $1 = "" ]]; then
diff --git a/gitprompt b/gitprompt
index ec44783..f96c8d4 100755
--- a/gitprompt
+++ b/gitprompt
@@ -3,6 +3,9 @@
trap 'print -n;exit 1' INT
autoload -U colors && colors
+
+estatus=0
+
#isgit="$(git rev-parse --is-inside-work-tree 2>/dev/null)"
isgit="$(git rev-parse --is-inside-work-tree 2>/dev/null)"
#if test (../)#.git(N) 2>/dev/null;then
@@ -12,10 +15,12 @@ if [[ $isgit == "true" ]];then
#timeout 3 git status -s
if [[ -n $(timeout -s KILL 2 git status -s) ]];then
gprompt+="⚡";
+ estatus=1
else
gprompt+="ʃ";
fi
gprompt+=")"
- printf " %s%s" "%{${fg[yellow]}%}" $gprompt
+ printf " %s%s" "%{${fg[yellow]}%}" $gprompt "%{$reset_color%}"
fi
+exit $estatus
diff --git a/mailboxes b/mailboxes
index 51f8d72..6eb48bd 100755
--- a/mailboxes
+++ b/mailboxes
@@ -34,9 +34,11 @@ echo "~/Mail/Kronos/Today \
$(find ~/Mail/ -type d -name new -printf '%d:%[email protected]:%h \n' \
| sort -t : -k 1,2 -r \
| cut -d : -f 3 \
- | /bin/grep -v -E '(Chro|Old|Junk|Kro|INBOX|Search|Dyne|Wnohang|Yahoo|Sent|Me|Archive)' \
+ | /bin/grep -v -E '(Chro|Old|Junk|Kro|INBOX|Search|Dyne|Wnohang|Yahoo|Sent|Me|Archive|Important|Todo)' \
| tr '\n' ' ' \
| tr -s ' ') \
+ ~/Mail/Important/ \
+ ~/Mail/Todo/ \
~/Mail/Archive/eBackup/"
diff --git a/mplayer b/mplayer
index 6c829e9..0b744d0 100755
--- a/mplayer
+++ b/mplayer
@@ -85,7 +85,7 @@ check_status(){
if [[ $fixedvo == 1 ]];then
pidof mplayer || return 1
echo >>| /tmp/mplayer.log
- retval=0
+ retval=1
for ff in /tmp/mplayer/*.fif;do
if check_pattern $ff;then
return $retval
@@ -160,7 +160,7 @@ if [[ ! -e $MPSOCKET ]] ;then
firstime=1
mkfifo $MPSOCKET
ln -sf $MPSOCKET /tmp/mplayer.fif
- notify-send "Mplayer" "mplayer starting up....."
+ #notify-send "Mplayer" "mplayer starting up....."
fi
exec &>>|/tmp/mplayer.log
@@ -181,7 +181,7 @@ preplay
[[ $firstime == 1 ]] && sleep 3
if [[ $stdin == 1 ]];then
- pecho "loadfile -" /tmp/mplayer.fif
+ pecho "loadfile /dev/fd/0" /tmp/mplayer.fif
else
pecho "loadfile \"$FILE\" 2" /tmp/mplayer.fif
fi
diff --git a/tmux-url b/tmux-url
index 0dec877..c2bcbab 100755
--- a/tmux-url
+++ b/tmux-url
@@ -1,5 +1,6 @@
#!/bin/zsh
-tmux capture-pane -t uake
+#tmux capture-pane -t uake
+tmux capture-pane
tmux save-buffer /tmp/mux-buffer
#LAST_URL=$(/bin/grep -i -P '(https?://|www.)[0-9A-Z\.\/\-\_~\?=]*' 2>/dev/null /tmp/mux-buffer | tac | $=DMENU)
diff --git a/wsync b/wsync
index 766b1bf..75e8797 100755
--- a/wsync
+++ b/wsync
@@ -1,27 +1,68 @@
#!/bin/zsh
+mkdir -p /tmp/wsync
+gproj=""
+
+sproj=$1
+trap logint INT
+
+logint(){
+ echo "$gproj" >| /tmp/.wsync
+ exit 3
+}
+
pread (){
echo
echo -n ">_ "
read
- }
+}
projdir="/home/raghavendra/Arch/Projects"
remotedir="/sate/gitole"
+if [[ -n $sproj ]];then
+ pread "Syncing $proj"
+ pushd $proj
+ if /bin/grep -q "Unnamed repo" .git/description;then
+ echo "Enter one line description"
+ >| .git/description
+ fi
+ if [[ ! -d $remotedir/$projname.git ]];then
+ git clone --mirror -v $proj /tmp/wsync/$projname.git
+ scp -q -r /tmp/wsync/$projname.git [email protected]:/$remotedir:t/
+
+ else
+ if ! gitprompt 2>/dev/null;then
+ print "Dirty repo"
+ pread "Commit $proj and then continue"
+ fi
+ git push --mirror -v $remotedir/$proj:t
+ fi
+ popd
+ echo "$proj done"
+
+else
for proj in $projdir/*
do
+ gproj="$proj"
+ projname=${proj:t}
pread "Syncing $proj"
pushd $proj
if /bin/grep -q "Unnamed repo" .git/description;then
echo "Enter one line description"
>| .git/description
fi
- if [[ ! -d $remotedir/$proj:t ]];then
- #git clone --mirror -v $proj $remotedir/$proj:t
- scp -q -r $proj [email protected]:/$remotedir:t/
+ if [[ ! -d $remotedir/$projname.git ]];then
+ git clone --mirror -v $proj /tmp/wsync/$projname.git
+ scp -q -r /tmp/wsync/$projname.git [email protected]:/$remotedir:t/
+
else
+ if ! gitprompt 2>/dev/null;then
+ print "Dirty repo"
+ pread "Commit $proj and then continue"
+ fi
git push --mirror -v $remotedir/$proj:t
fi
popd
echo "$proj done"
done
+fi