20 Jun

Script to Convert FLV to AVI

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
04 May

A Shell Script to Create a Build of Firefox Extension

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"

05 Dec

Stop crond When mysqld is Down

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";
05 May

SourceForge Project Packager – from SVN source

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/`;