Get a Random Futurama Quote

Useless - but fun - get a random Futurama Quote


curl -Is slashdot.org | egrep '^X-(F|B)' | cut -d \- -f 2

Create Random Password

Use this command to create a random password


< /dev/urandom tr -dc A-Za-z0-9_ | head -c8

Also see…

CDPATH

CDPATH is to cd what PATH is to exectable. You can go to a folder inside any of the CDPATH folders by just cd 'folder name' - no mater where you are currently.


export CDPATH='.:~:/var/www/html:~/Scripts'

Use ffmpeg to create a screencast

You can use this command to create a screencast using ffmpeg.


ffmpeg -f x11grab -s 800x600 -i :0.0 /tmp/screencast.mpg

Backup Del.icio.us posts

Backup all delicious bookmarks using this command


wget --user=username --password=password https://api.del.icio.us/v1/posts/all -O bookmarks.xml

Replacing in Found Files

Replace one string by another in all file found by find.


find . -name *whatyouwant* -exec perl -pi.bak -e 's/TEXT_TO_REPLACE/TEXT_TO_REPLACE_IT_WITH/g' {} \;

Backup and Restore Boot sector

Use these commands to backup/restore your boot sector


dd if=/dev/hda of=bootsector.img bs=512 count=1 # backup
dd if=bootsector.img of=/dev/hda #restore

Original Article

Post to Delicious From Command Line

Post to Delicious


curl "https://<username>:<password>@api.del.icio.us/v1/posts/add?&url=[URL]&description=[TITLE]&tags=[TAGS]&replace=no"

Regular Expression Twitter Linker

Regular expression to link twitter users…


Replace this '@(\w+)'
With this '<a href="http://twitter.com/\1">@\1</a>'

Object Or Array Check in JavaScirpt

Test whether an object is an object or an array


if(Object.prototype.toString.apply(arr) === '[object Array]') alert("Array")

Original Article