Jokes – many to be downloaded once..

All work and no fun makes Jack dull boy. So lets do something for fun. Here is a one liner I wrote sometime back.  The original idea is not mine and I don\’t remeber where I got the idea from but it was some other one liner that I was browsing for some oracle query. Anyway here\’s the one liner to get lot of jokes in one file.

#!/bin/bash
for i in `echo 000{0..9} 00{10..99} 0{100..999} {1000..1600}` ; do links -dump http://www.robsjokes.com/$i/index.html | sed \’/Random Joke/,/Next Joke/!d\’ | sed \’/^$/,/^$/!d\’ >> ~/Rob.jokes ; echo \’%\’ >> ~/Rob.jokes ;echo $i; done

And here are some of the jokes that you would get (Notice they are not mine and I do not have any rights on the content of the jokes)

Q: Why is the blonde\’s brain the size of a pea in the morning?
A: It swells at night.

%

Q: What did the blonde do when she heard that 90% of accidents occur around the home?
A: She moved.

%

Q: What\’s five miles long and has an IQ of forty?
A: A blonde parade.

%

Q: Why is it okay for blondes to catch cold?
A: They don\’t have to worry about blowing their brains out.

core dump checking script.

I was testing a program which crashing every now and then. It is very difficult in such scenarios to keep looking for the core file or keep checking for the running process. So I wrote this simple script that can check for core file in the particular path and keep running until it finds one. You can hack this script to send a mail once the core is found. This is a very simple script. And this should work on solaris too..

#!/bin/bash –

#===============================================================================

#

# FILE: check_core.sh

#

# USAGE: ./check_core.sh

#

# DESCRIPTION: Script to check for core dumps

#

# OPTIONS: —

# REQUIREMENTS: —

# BUGS: —

# NOTES: —

# AUTHOR: Amit Agarwal (AKA), amit.agarwal@amit-agarwal.co.in

# COMPANY: Individual

# VERSION: 1.0

# CREATED: 12/14/2009 10:19:51 AM IST

# REVISION: —

#===============================================================================

path=/home/amit/

app_name=wine

app_pid=

[ -z $app_name ] || echo $app_name , pid_app=$(ps -u `whoami` -f|grep $app_name |grep -v grep)

[ -z $app_pid ] || echo $app_pid , pid_pid=$(ps -eaf|grep $app_pid |grep -v grep)

if [ -z $pid_app ]

then

while (true)

do

cd $path

if [ -f core ]

then

echo \”Core found\”

exit

else

echo \”continue\”

sleep 5

fi

done

fi

\"Reblog

geoip lookup with curl on geody.com

$ geoip(){curl -s \"http://www.geody.com/geoip.php?ip=${1}\" | sed \'/^IP:/!d;s/<[^>][^>]*>//g\' ;}

\"commandlinefu.com\"

by David Winterbottom (codeinthehole.com)

\"\"
\"\"

\"\"

URL: http://feedproxy.google.com/~r/Command-line-fu/~3/TiutyTYxoU0/geoip-lookup

\"Reblog