Archive for September, 2008

Finding the Factorial using Recursion

Finding the Factorial using Recursion in javascript.


function factorial(x) {
	if(x <= 1) return 1;
	return x*factorial(x-1);
}
factorial(5);

Packet Sniffing

Configure ‘eth0′ in promiscuous mode to gather packets (sniffing)


ifconfig eth0 promisc

Remove Deb Package

Remove a deb package from the system


dpkg -r package_name

Verify RPM Package

Verify the integrity of a rpm package


rpm --checksig package.rpm

Burn an ISO image

Burn an ISO image


cdrecord -v dev=/dev/cdrom cd.iso

Build RPM From RPM Source

Build a rpm package from a rpm source


rpmbuild --rebuild package_name.src.rpm

Download Multiple URLs

Command to download a series of urls with zero padding files…


for ((i=1;i<20;i++))
do wget "http://img55.onemanga.com/mangas/00000004/00000000/Naruto-Pilot-`printf "%02d" $i`.jpg"; done
done

PS Command Forest Mode

Displays linux tasks in a hierarchical mode


ps -e -o pid,args --forest

Archive all files with a given extension

Find all files with ‘.log’ extention and make an bzip archive


find /var/log -name '*.log' | tar cv --files-from=- | bzip2 > log.tar.bz2

Configure IP Address

Configure IP Address using the ifconfig command


ifconfig eth0 192.168.1.1 netmask 255.255.255.0