Saturday, March 6, 2010

Dead Donkey.. Nice one...

The Dead Donkey!!
 
City boy, Raj, moved to the village and bought a donkey from an old farmer for Rs.1000. The farmer agreed to deliver the donkey the next day.
The next day the farmer drove up and said, "Sorry Raj-ji, but I have some bad news. The donkey died while I was bringing him here."
Raj replied: "Well then, just give me my money back."
The farmer said: "Can't do that either. I went and spent it already."
Raj said: "OK then, just unload the donkey."
The farmer asked: "What you are going to do with a dead donkey?!"
Raj: "I'm going to raffle him off." (Note: Raffle is like lottery - a group of people draw lots each paying the same amount for a ticket and there is a big prize for the people who win.)
Farmer: "You can't raffle off a dead donkey!"
Raj: "Sure I can. Watch me. I just won't tell anybody he's dead."
A month later the farmer met up with Raj and asked, "What happened with that dead donkey?"
Raj: "I raffled him off. I sold 500 tickets at Rs.10 each and made a profit of Rs.4990 with the donkey worth Rs.1000 as the prize."
Farmer: "Didn't anyone complain?"
Raj: "Just the guy who won. So I gave him back his Rs.10"
 
Moral of the story - No situation is so bad that it cannot be turned around. You need to just think hard, sorry! smart .

Wednesday, February 10, 2010

Install cpulimit

Install cpulimit

Type the following commands to install latest stable release:
# cd /tmp
# wget 'http://downloads.sourceforge.net/cpulimit/cpulimit-1.1.tar.gz'
# tar -zxvf cpulimit-1.1.tar.gz
# cd cpulimit-1.1
# make
# cp cpulimit /usr/local/sbin/
# rm -rf cpulimit*

A note about Debian / Ubuntu Linux users

Type the following command to install cpulimit:
$ sudo apt-get update
$ sudo apt-get install cpulimit

How do I use cpulimit?

To limit CPU usage of the process called firefox to 30%, enter:
# cpulimit -e firefox -l 30
To limit CPU usage of the process to 30% by using its PID, enter:
# cpulimit -p 1313 -l 30
To find out PID of the process use any of the following:
# ps aux | less
# ps aux | grep firefox
# pgrep -u vivek php-cgi
# pgrep lighttpd

You can also use absolute path name of the executable, enter:
# cpulimit -P /opt/firefox/firebox -l 30
Where,

  • -p : Process PID.
  • -e : Process name.
  • -l : percentage of CPU allowed from 0 to 100.
  • -P: absolute path name of the executable program file.

Monday, February 1, 2010

Monday, January 25, 2010