summaryrefslogtreecommitdiffstats
authorRaghavendra D Prabhu <[email protected]>2011-04-10 09:28:38 (GMT)
committer Raghavendra D Prabhu <[email protected]>2011-04-10 09:28:38 (GMT)
commit9be7ca6fd73c99610bec6c2ec608e8f3ffd1fdd0 (patch) (unidiff)
tree723f9870d10e750ae6b14cbb0b409b4ac04a57ab
parentd116dc185b304f35c357f6db2863532ed2a158d1 (diff)
downloadScripts-9be7ca6fd73c99610bec6c2ec608e8f3ffd1fdd0.zip
Scripts-9be7ca6fd73c99610bec6c2ec608e8f3ffd1fdd0.tar.gz
Scripts-9be7ca6fd73c99610bec6c2ec608e8f3ffd1fdd0.tar.bz2
Updated scripts/ tomit - mouse killer / cmodprobe - modprobe handler
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xbldins11
-rwxr-xr-xbrowser3
-rwxr-xr-xcmodprobe (renamed from modprobe)5
-rwxr-xr-xdmenu_run2
-rwxr-xr-xflplay6
-rw-r--r--functions28
-rwxr-xr-xmailboxes4
-rwxr-xr-xmplayer6
-rwxr-xr-xpytrends.py2
-rwxr-xr-xssh-expect2
-rwxr-xr-xtomit66
-rwxr-xr-xvolchange2
-rwxr-xr-xwsync8
13 files changed, 121 insertions, 24 deletions
diff --git a/bldins b/bldins
index 34d1fb8..4f9c2fd 100755
--- a/bldins
+++ b/bldins
@@ -51,7 +51,6 @@ if [[ $install == 0 ]];then
51 make localyesconfig || exit 1 51 make localyesconfig || exit 1
52 else 52 else
53 #cp ~/config/kconfig/config .config 53 #cp ~/config/kconfig/config .config
54 KCFLAGS=" -march=native -O2 -pipe "
55 make menuconfig || exit 1 54 make menuconfig || exit 1
56 make modules_prepare || exit 1 55 make modules_prepare || exit 1
57 56
@@ -62,7 +61,7 @@ if [[ $install == 0 ]];then
62 echo "Building bzImage!" 61 echo "Building bzImage!"
63 62
64 #/usr/bin/time -p $=BUILDCMD | tee $LOGFILE || exit 1 63 #/usr/bin/time -p $=BUILDCMD | tee $LOGFILE || exit 1
65 (/usr/bin/time -p $=BUILDCMD || exit 1) | tee $LOGFILE 64 (/usr/bin/time -p $=BUILDCMD || exit 1) |& tee $LOGFILE
66 65
67 ver=${kernver[(ws:-:)-1]} 66 ver=${kernver[(ws:-:)-1]}
68 kernelname=${1:-$ver} 67 kernelname=${1:-$ver}
@@ -110,15 +109,15 @@ fallback_image=\"/boot/kernel26-fallback${kernelname}.img\"
110fallback_options=\"-S autodetect\" 109fallback_options=\"-S autodetect\"
111" | sudo tee /etc/mkinitcpio.d/kernel26${kernelname}.preset 110" | sudo tee /etc/mkinitcpio.d/kernel26${kernelname}.preset
112 111
113pread "Verify mkinitcpio.conf and others" 112echo "Verify mkinitcpio.conf and others"
114pread "Installing modules to /lib/modules/$kernver" 113echo "Installing modules to /lib/modules/$kernver"
115 114
116sudo make modules_install 115sudo make modules_install
117 116
118pread "Installing firmware" 117echo "Installing firmware"
119sudo make firmware_install 118sudo make firmware_install
120 119
121pread "Time for headers..hmmm" 120echo "Time for headers..hmmm"
122 121
123sudo install -D -m644 Makefile /usr/src/linux-${kernver}/Makefile 122sudo install -D -m644 Makefile /usr/src/linux-${kernver}/Makefile
124sudo install -D -m644 kernel/Makefile /usr/src/linux-${kernver}/kernel/Makefile 123sudo install -D -m644 kernel/Makefile /usr/src/linux-${kernver}/kernel/Makefile
diff --git a/browser b/browser
index 2364ba8..ed1a7a1 100755
--- a/browser
+++ b/browser
@@ -18,7 +18,8 @@ if [[ $URL == *youtube.com/watch* ]];then
18 #DFILE= 18 #DFILE=
19 #trap 'rm $DFILE;kill $$' TERM 19 #trap 'rm $DFILE;kill $$' TERM
20 #trap '~/bin/mplayeraux stop' INT 20 #trap '~/bin/mplayeraux stop' INT
21 tubeplay $URL 21 #tubeplay $URL
22 cvlc "$URL"
22 #sleep 2 23 #sleep 2
23 #DFILE=$(ls -Acr |tail -1) 24 #DFILE=$(ls -Acr |tail -1)
24 #export DFILE 25 #export DFILE
diff --git a/modprobe b/cmodprobe
index 60fee0a..4ff7864 100755
--- a/modprobe
+++ b/cmodprobe
@@ -1,4 +1,5 @@
1#!/bin/zsh 1#!/bin/zsh
2exec &>>~/logs/cmod.log
2export HHOME="/home/raghavendra" 3export HHOME="/home/raghavendra"
3modname=$1 4modname=$1
4mprobe="/sbin/modprobe" 5mprobe="/sbin/modprobe"
@@ -24,13 +25,13 @@ if [[ $? != 0 ]];then
24 export PATH="/usr/bin/vendor_perl:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/lib/perl5/vendor_perl/bin:/usr/bin/core_perl:/opt/plan9/bin" 25 export PATH="/usr/bin/vendor_perl:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/lib/perl5/vendor_perl/bin:/usr/bin/core_perl:/opt/plan9/bin"
25 # Optional 26 # Optional
26 #unset CFLAGS CXXFLAGS LDFLAGS 27 #unset CFLAGS CXXFLAGS LDFLAGS
27 export EXTRA_LDFLAGS=" -s " 28 #export EXTRA_LDFLAGS=" -s "
28 pushd $prefix || exit 1 29 pushd $prefix || exit 1
29 for key in ${(k)module_table};do 30 for key in ${(k)module_table};do
30 if [[ $modname == *$key* ]];then 31 if [[ $modname == *$key* ]];then
31 file=$module_table[$key] 32 file=$module_table[$key]
32 if [[ -n $file ]];then 33 if [[ -n $file ]];then
33 ./$file &>>|$HHOME/logs/cmod.log 34 ./$file
34 /sbin/depmod 35 /sbin/depmod
35 $mprobe $file 36 $mprobe $file
36 else 37 else
diff --git a/dmenu_run b/dmenu_run
index 3313680..353fedb 100755
--- a/dmenu_run
+++ b/dmenu_run
@@ -1,4 +1,4 @@
1#!/bin/zsh 1#!/bin/zsh
2PATH="/home/raghavendra/bin:/opt/wine/bin:/bin:/usr/bin:/sbin:/usr/sbin" 2#PATH="/home/raghavendra/bin:/opt/wine/bin:/bin:/usr/bin:/sbin:/usr/sbin"
3#exe=`dmenu_path_c | dmenu -i -fa 'xft:Bitstream:pixelsize=14' -nb black -nf white -p : ${1+"[email protected]"}` && exec ${=exe} 3#exe=`dmenu_path_c | dmenu -i -fa 'xft:Bitstream:pixelsize=14' -nb black -nf white -p : ${1+"[email protected]"}` && exec ${=exe}
4exe=`dmenu_path | yeganesh -f -- -i -fn 'xft:Bitstream:pixelsize=19' -m 1 -sb aquamarine4 -nb grey2 -nf grey50 -p : ` && exec ${=exe} 4exe=`dmenu_path | yeganesh -f -- -i -fn 'xft:Bitstream:pixelsize=19' -m 1 -sb aquamarine4 -nb grey2 -nf grey50 -p : ` && exec ${=exe}
diff --git a/flplay b/flplay
index da33d22..5cb4594 100755
--- a/flplay
+++ b/flplay
@@ -3,6 +3,12 @@ fpid=$(pidof plugin-container)
3 3
4fd=$(lsof | grep $fpid | /bin/grep '(deleted)' | /bin/grep FlashX | /bin/grep -o '[0-9]*u ' | head -1) 4fd=$(lsof | grep $fpid | /bin/grep '(deleted)' | /bin/grep FlashX | /bin/grep -o '[0-9]*u ' | head -1)
5 5
6
7if [[ -z $fd ]];then
8 fpid=$(pidof firefox-bin)
9 fd=$(lsof | grep $fpid | /bin/grep "media_cache" | /bin/grep -o '[0-9]*u ' | head -1)
10fi
11
6fd=$fd[1,-3] 12fd=$fd[1,-3]
7 13
8print /proc/$fpid/fd/$fd 14print /proc/$fpid/fd/$fd
diff --git a/functions b/functions
index 26ead44..99aa69d 100644
--- a/functions
+++ b/functions
@@ -23,7 +23,7 @@ $HOME/bin/mplayer "[email protected]"
23 23
24function etym(){ 24function etym(){
25word="[email protected]" 25word="[email protected]"
26/usr/bin/w3m -dump "http://www.etymonline.com/index.php?search=$word&searchmode=none" 26/usr/bin/w3m -dump "http://www.etymonline.com/index.php?search=$word&searchmode=none" | sed -n -e "/^$word/,/^$/p"
27} 27}
28 28
29function getmovie (){ 29function getmovie (){
@@ -58,7 +58,7 @@ mountole(){
58 echo "Failed :( " 58 echo "Failed :( "
59 return 1 59 return 1
60 fi 60 fi
61 ssh-expect 61 ssh-expect
62} 62}
63 63
64 64
@@ -68,8 +68,8 @@ bbcradio() { local s;echo "Select a station:";select s in 1 1x 2 3 4 5 6 7 "Asia
68 68
69 69
70function def(){ 70function def(){
71 wn $1 -over 71 wn "$@" -over
72 if [ $? != "0" ];then echo $1 >> ~/wordlist;fi 72 if [ $? != "0" ];then echo "$@" >> ~/wordlist;fi
73} 73}
74 74
75 75
@@ -115,12 +115,28 @@ for i in $pkg
115do 115do
116 for j in `pacman -Ql $i | cut -d " " -f 2` 116 for j in `pacman -Ql $i | cut -d " " -f 2`
117 do 117 do
118 grep -l -i $term $j 118 =grep -l $term $j
119 done 119 done
120done 120done
121#set +x 121#set +x
122} 122}
123 123
124function gdb(){
125/usr/bin/gdb --quiet
126}
127
128function genscope(){
129 /usr/bin/cscope -b -R -q
130}
131function cscope(){
132 #/usr/bin/cscope -d -f $(readlink -f (../)#cscope.out) [email protected]
133 file=$(readlink -f (../)#cscope.out)
134 [[ $? != 0 ]] && return 1
135 pushd $file:h
136 /usr/bin/cscope -d [email protected]
137 popd
138}
139
124function cscore() 140function cscore()
125{ 141{
126 curl -s -e "http://www.google.com" -A "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1" "http://livechat.rediff.com:80/sports/score/score.txt" 142 curl -s -e "http://www.google.com" -A "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1" "http://livechat.rediff.com:80/sports/score/score.txt"
@@ -528,7 +544,7 @@ function {news,mutt,ncm,weechat,weechat-curses,newsbeuter,ncmpcpp,atop,rtorrent,
528 544
529 : ${(AA)appMap:=${(z)WSETS}} 545 : ${(AA)appMap:=${(z)WSETS}}
530 546
531 if [[ -z $1 ]];then 547 if pgrep $app;then
532 sess=$(tux takeme $app) 548 sess=$(tux takeme $app)
533 tmux switch-client -t $sess 549 tmux switch-client -t $sess
534 return 550 return
diff --git a/mailboxes b/mailboxes
index 6eb48bd..61e612d 100755
--- a/mailboxes
+++ b/mailboxes
@@ -34,11 +34,13 @@ echo "~/Mail/Kronos/Today \
34 $(find ~/Mail/ -type d -name new -printf '%d:%[email protected]:%h \n' \ 34 $(find ~/Mail/ -type d -name new -printf '%d:%[email protected]:%h \n' \
35 | sort -t : -k 1,2 -r \ 35 | sort -t : -k 1,2 -r \
36 | cut -d : -f 3 \ 36 | cut -d : -f 3 \
37 | /bin/grep -v -E '(Chro|Old|Junk|Kro|INBOX|Search|Dyne|Wnohang|Yahoo|Sent|Me|Archive|Important|Todo)' \ 37 | /bin/grep -v -E '(Chro|Old|Junk|Kro|INBOX|Search|Dyne|Wnohang|Yahoo|Sent|Me|Archive|Important|Todo|KVM)' \
38 | tr '\n' ' ' \ 38 | tr '\n' ' ' \
39 | tr -s ' ') \ 39 | tr -s ' ') \
40 ~/Mail/Important/ \ 40 ~/Mail/Important/ \
41 ~/Mail/Todo/ \ 41 ~/Mail/Todo/ \
42 ~/Mail/Archive/NITK/ \
43 ~/Mail/Archive/Msoft/ \
42 ~/Mail/Archive/eBackup/" 44 ~/Mail/Archive/eBackup/"
43 45
44 46
diff --git a/mplayer b/mplayer
index 0b744d0..0925a4f 100755
--- a/mplayer
+++ b/mplayer
@@ -181,9 +181,11 @@ preplay
181[[ $firstime == 1 ]] && sleep 3 181[[ $firstime == 1 ]] && sleep 3
182 182
183if [[ $stdin == 1 ]];then 183if [[ $stdin == 1 ]];then
184 pecho "loadfile /dev/fd/0" /tmp/mplayer.fif 184 #pecho "loadfile /dev/fd/0" /tmp/mplayer.fif
185 /usr/bin/mplayer -
186 exit 110
185else 187else
186 pecho "loadfile \"$FILE\" 2" /tmp/mplayer.fif 188 pecho "loadfile \"$FILE\" 2" $MPSOCKET
187fi 189fi
188 190
189check_status 191check_status
diff --git a/pytrends.py b/pytrends.py
index 94cfb4d..479c285 100755
--- a/pytrends.py
+++ b/pytrends.py
@@ -1,4 +1,4 @@
1#!/usr/bin/python 1#!/usr/bin/python2
2import cjson 2import cjson
3import urllib2 3import urllib2
4from contextlib import closing 4from contextlib import closing
diff --git a/ssh-expect b/ssh-expect
index c0e4efc..10477f7 100755
--- a/ssh-expect
+++ b/ssh-expect
@@ -2,5 +2,5 @@
2 2
3ssh-add -L | =grep -iq id_rsa || ssh-add 3ssh-add -L | =grep -iq id_rsa || ssh-add
4if ! mount | =grep -iq sate;then 4if ! mount | =grep -iq sate;then
5 sshfs -p 17281 -C [email protected]:/ /sate -o uid=1000,gid=101,intr || exit 1 5 (sshfs -p 17281 -C [email protected]:/ /sate -o uid=1000,gid=101,intr || exit 1) &
6fi 6fi
diff --git a/tomit b/tomit
new file mode 100755
index 0000000..429f89d
--- a/dev/null
+++ b/tomit
@@ -0,0 +1,66 @@
1#!/usr/bin/python2
2import signal
3import time, sys
4import subprocess, shlex
5import daemon
6import atexit
7
8import setproctitle as setp
9
10from Xlib.display import Display
11from Xlib import X
12from Xlib.protocol import request
13from Xlib.protocol import request,rq
14
15class Tomit(object):
16 def __init__(self,daemonize):
17 setp.setproctitle("tomit")
18 self.disp = Display()
19 self.mask = X.PointerMotionMask | X.PointerMotionHintMask | X.LeaveWindowMask | X.EnterWindowMask
20 self.root = self.disp.screen().root
21 self.root.change_attributes(event_mask = self.mask)
22 self.root.grab_pointer(1,self.mask,X.GrabModeSync,X.GrabModeAsync,X.NONE,X.NONE,X.CurrentTime)
23
24 self.xin='xinput set-prop "PIXART USB OPTICAL MOUSE" "Device Enabled"'
25 signal.signal(signal.SIGUSR1,self.renable)
26 atexit.register(self.cleanup)
27 if (daemonize == 1):
28 with daemon.DaemonContext():
29 self.loop()
30 else:
31 self.loop()
32
33 def cleanup(self):
34 proc = \
35 subprocess.Popen(shlex.split(self.xin+' "1"'))
36 proc.communicate()
37 return proc.returncode
38
39 def loop(self):
40 while True:
41 subprocess.Popen(shlex.split(self.xin+' "0"'))
42 ev = self.disp.next_event()
43 print repr(ev)
44 time.sleep(100)
45
46 def renable(self,signum,frame):
47 subprocess.Popen(shlex.split(self.xin+' "1"'))
48 self.disp.ungrab_pointer(X.CurrentTime)
49 while True:
50 proc = subprocess.Popen(shlex.split("inotifywait -t 60 \
51 /dev/input/by-id/usb-PIXART_USB_OPTICAL_MOUSE-event-mouse"))
52 proc.communicate()
53 if (proc.returncode == 2):
54 print "Re-disabling pointer"
55 subprocess.Popen(shlex.split(self.xin+' "0"'))
56 self.root.grab_pointer(1,self.mask,X.GrabModeSync,X.GrabModeAsync,X.NONE,X.NONE,X.CurrentTime)
57 break
58 else:
59 time.sleep(20)
60
61
62if __name__ == "__main__":
63 daemonize = 1
64 if len(sys.argv)>1:
65 daemonize = int(sys.argv[1])
66 sys.exit(Tomit(daemonize))
diff --git a/volchange b/volchange
index d94f935..e056f30 100755
--- a/volchange
+++ b/volchange
@@ -21,7 +21,7 @@ else
21 if [[ $1 = '1' ]];then curvol="10%+" ;fi 21 if [[ $1 = '1' ]];then curvol="10%+" ;fi
22 if [[ $1 = '2' ]];then curvol="10%-";fi 22 if [[ $1 = '2' ]];then curvol="10%-";fi
23 if [[ $1 = 'mute' ]];then 23 if [[ $1 = 'mute' ]];then
24 amixer sset Master playback mute 24 amixer sset Master playback toggle
25 exit 25 exit
26 fi 26 fi
27 amixer sset Master playback $curvol 27 amixer sset Master playback $curvol
diff --git a/wsync b/wsync
index 9db4aad..a868a8b 100755
--- a/wsync
+++ b/wsync
@@ -20,11 +20,13 @@ projdir="/home/raghavendra/Arch/Projects"
20remotedir="/sate/gitole" 20remotedir="/sate/gitole"
21 21
22if [[ -n $sproj ]];then 22if [[ -n $sproj ]];then
23 proj=$sproj
23 pread "Syncing $proj" 24 pread "Syncing $proj"
24 pushd $proj 25 pushd $proj
25 if /bin/grep -q "Unnamed repo" .git/description;then 26 if /bin/grep -q "Unnamed repo" .git/description;then
26 echo "Enter one line description" 27 echo "Enter one line description"
27 >| .git/description 28 >| .git/description
29 cp .git/description $remotedir/$proj:t/
28 fi 30 fi
29 if [[ ! -d $remotedir/$projname.git ]];then 31 if [[ ! -d $remotedir/$projname.git ]];then
30 git clone --mirror -v $proj /tmp/wsync/$projname.git 32 git clone --mirror -v $proj /tmp/wsync/$projname.git
@@ -35,7 +37,8 @@ if [[ -n $sproj ]];then
35 print "Dirty repo" 37 print "Dirty repo"
36 pread "Commit $proj and then continue" 38 pread "Commit $proj and then continue"
37 done 39 done
38 git push --mirror -v $remotedir/$proj:t 40 #git push --mirror -v $remotedir/$projname.git
41 git push --mirror -v ssh://[email protected]/$remotedir:t/$projname.git
39 fi 42 fi
40 popd 43 popd
41 echo "$proj done" 44 echo "$proj done"
@@ -50,6 +53,7 @@ do
50 if /bin/grep -q "Unnamed repo" .git/description;then 53 if /bin/grep -q "Unnamed repo" .git/description;then
51 echo "Enter one line description" 54 echo "Enter one line description"
52 >| .git/description 55 >| .git/description
56 cp .git/description $remotedir/$proj:t/
53 fi 57 fi
54 if [[ ! -d $remotedir/$projname.git ]];then 58 if [[ ! -d $remotedir/$projname.git ]];then
55 git clone --mirror -v $proj /tmp/wsync/$projname.git 59 git clone --mirror -v $proj /tmp/wsync/$projname.git
@@ -60,7 +64,7 @@ do
60 print "Dirty repo" 64 print "Dirty repo"
61 pread "Commit $proj and then continue" 65 pread "Commit $proj and then continue"
62 fi 66 fi
63 git push --mirror -v $remotedir/$proj:t 67 git push --mirror -v ssh://[email protected]/$remotedir:t/$projname.git
64 fi 68 fi
65 popd 69 popd
66 echo "$proj done" 70 echo "$proj done"