Thursday, October 29th, 2009 11:30 AM
This script will run check for ubuntu launch once every 5 mins and let you know if there is an launch.
while [ 1 ]; do if [ -z "`curl -I "http://cdimage.ubuntu.com/releases/9.10/release/"|grep "404"`" ]; then kdialog --msgbox "9.10 Released"; exit; fi; sleep 300; done
No Comments »
Saturday, November 15th, 2008 11:22 PM
An easier way to batch convert images using the ‘convert’ command…
#!/bin/sh
# An Easy command to use the convert command. Makes sure that the rename problem don't happen
if [ ! -d "Out" ]; then
mkdir Out
fi
sel="*.*"
if [ $# -eq 2 ] ; then
sel=$2
fi
for i in $sel; do
echo -n "Converting $i ... "
convert $1 $i Out/$i
echo "Done"
done
3 Comments »
Friday, June 20th, 2008 11:00 PM
This will convert a flv file to a avi file. I got this off linux.com. It uses mencoder – so make sure you have that.
#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: $0 {-divx|-xvid} list_of_flv_files"
exit 1
fi
# video encoding bit rate
V_BITRATE=1000
while [ "$1" ]; do
case "$1" in
-divx)
MENC_OPTS="-ovc lavc -lavcopts \
vcodec=mpeg4:vbitrate=$V_BITRATE:mbd=2:v4mv:autoaspect"
;;
-xvid)
MENC_OPTS="-ovc xvid -xvidencopts bitrate=$V_BITRATE:autoaspect"
;;
*)
if file "$1" | grep -q "Macromedia Flash Video"; then
mencoder "$1" $MENC_OPTS -vf pp=lb -oac mp3lame \
-lameopts fast:preset=standard -o \
"`basename $1 .flv`.avi"
else
echo "$1 is not Flash Video. Skipping"
fi
;;
esac
shift
done
2 Comments »
Sunday, May 4th, 2008 11:03 PM
This shell script will create a build of a firefox extension in linux. This is created according to my details(eg, the guid has @binnyva.com in it) – but you can modify it and use it yourself.
app=$1
folder=$2
if [ $# -eq 0 ] ; then
echo "Useage: sh build.sh []"
elif [ $# -eq 1 ] ; then
folder="$1@binnyva.com/"
fi
rm $app.xpi
cp -r $folder temp
cd temp
rm -rf .git
zip -r $app.xpi .>/dev/null
mv $app.xpi ..
cd ..
rm -rf temp
echo "Built $app successfully"
No Comments »
Wednesday, December 5th, 2007 11:01 PM
A perl script to stop crond if mysqld is down
#!/usr/bin/perl
# See if MySQL server is alive or not
$mysql_status = `/etc/init.d/mysqld status`;
print "MySQL Status: $mysql_status\n";
unless($mysql_status =~ /running/) {
print "Stopping Cron... ";
#If MySQL is not running, kill the crond
$cron = `/etc/init.d/crond stop`;
print $cron;
}
print "\n";
No Comments »
Monday, October 29th, 2007 10:46 PM
Prints all the arguments of the function. This function uses console.log if firebug is available – else, uses alert.
function p() {
for(var i=0; i<<arguments.length; i++) {
if(window.console) console.log(arguments[i]);
else alert(arguments[i]);
}
}
No Comments »
Monday, July 9th, 2007 10:39 PM
One can use awk to get a specific column from a command output…
First column of the command
date|awk '{print $1}'
11th Column of the command
ps aux|awk '{print $11}'
Use a different Field separator
cat /etc/passwd|awk -F ':' '{print $1}'
[tags]awk,sed,shell,script,output,filter,text,cli,linux,string,separator[/tags]
No Comments »
Wednesday, June 27th, 2007 08:28 PM
This command will list all the files a folder without their extensions. Comes handy when doing shell scripting
perl -e 'while(<*.*>){s/\..{3}$//i;print "File \"$_\"\n";}print "\n";'
No Comments »
Saturday, May 5th, 2007 09:05 PM
This script will package your SVN code to a tar.gz file. Just give the name of the project as the first argument. Like this…
perl packager.pl jus5
#!/usr/bin/perl
#Package a Sourceforge project from its SVN source.
die("Please provide the name of the project as the argument") unless($ARGV[0]);
$project=$ARGV[0];
#$project='jus5';
`svn checkout https://$project.svn.sourceforge.net/svnroot/$project`;
`find $project/ -name .svn -exec rm -rf {} \\;`;
`tar -czf $project.tar.gz $project/`;
`rm -rf $project/`;
No Comments »