ii aka IRC It – the tiniest IRC Client

Today I came across a wonderful IRC Client http://tools.suckless.org/ii/

Install II
Download it from above URL and RTFM to install.

Start
ii -help

OR

ii -i IRCDIR -s irc.freenode.net -m SOMENICK -f FULLNAME &

Explanation
Use any empty directory name on the place of IRCDIR
“&” will background the process

Now you will get “out” files in IRCDIR . Use “tail -F out” on those files to check what’s going on.

Logging In (for freenode irc)
echo "/j nickserv identify SOMENICK SOMEPASSWD" > IRCDIR/irc.freenode.net/in

Join Channel
echo "/j #CHANNELNAME" > IRCDIR/irc.freenode.net/in

Talk in Channel
echo "SOMEMSG" > IRCDIR/irc.freenode.net/#CHANNELNAME/in

Send Private Message
echo "/privmsg SOMEOTHERNICK SOMEMSG" > IRCDIR/irc.freenode.net/#CHANNELNAME/in

Part / Leave Channel
echo "/l bye" > IRCDIR/irc.freenode.net/#CHANNELNAME/in

Thanks to drewid[rogue]@irc.oftc.net on #ii

tmux – terminal multiplexer – an alternative for screen

I really admire OpenBSD projects. “tmux” aka Terminal Multiplexer is one of them.
Today Vedang Manerikar, my co-worker told me that he uses “tmux” rather than “GNU Screen”. So I decided to try “tmux” and after some googling I found that GNU Screen development has stopped 2 years back and it’s almost a dead project. Whereas “tmux” is actively developed by OpenBSD community. I just spent around 1.5 hours learning the common key-bindings of “tmux”. My 1.5 hours experience says “tmux” is better than “screen”.

The first feature I liked is windows numbering. 1-9 and then it starts with a-z. OTOH “screen” numbers windows from 0-n where n is a number. This way you can not access windows with 10 and onwards easily. But in “tmux” you can as after 9 “tmux” uses alphabets to name windows.

The second feature is “automatically window renaming depending on command” … this is handy where you don’t have to everytime rename a window and saves time.

That’s the quick observation. Will post other interesting features as I find them.

we won… bleed blue

finally we won the cricket world cup …. i am so happy….

Photo Courtesy : http://timesofindia.indiatimes.com/wc-final-india-vs-sri-lanka/WC-Final-India-vs-Sri-Lanka/cwcphoto/7853335.cms

the winning moment

The Winning Moment - Yuvraaj Singh and MS Dhoni

man of the match

Man of the Match - MS Dhoni

excellent innings

Excellent Innings - Gautam Gambhir

man of the tournament

Man of the Tournament - Yuvraaj Singh

the master blaster

Sachin Tendulkar

zhaeer khan

Zhaeer Khan aka Zak

Mahela Jayawardene

Mahela Jayawardene

Indian Cricket Team - 2011 Cricket World Cup Winner

Indian Cricket Team - 2011 Cricket World Cup Winner

Photo Courtesy : http://timesofindia.indiatimes.com/wc-final-india-vs-sri-lanka/WC-Final-India-vs-Sri-Lanka/cwcphoto/7853335.cms

Celebration after Victory - I

Celebration after Victory - I

Celebration after Victory - II

Celebration after Victory - II

Sachin over Kohali's shoulders with Pathan and Bhajji waving Tricolor

Sachin over Kohali's shoulders with Pathan and Bhajji waving Tricolor

Sachin waving Tiranga

Sachin waving Tiranga

Sachin and Team Members

Sachin and Team Members

Celebration after Victory - III

Celebration after Victory - III

Sachin with former leg spinner Anil Kumble

Sachin with former leg spinner Anil Kumble

Sachin with his kids - Sarah and Arjun

Sachin with his kids - Sarah and Arjun

Sachin and Gautam Gambhir

Sachin and Gautam Gambhir

Harbhajan, Sachin & Yuvraaj Singh

Harbhajan, Sachin & Yuvraaj Singh

Sreesanth, Sachin, Bhajji & Suresh Raina

Sreesanth, Sachin, Bhajji & Suresh Raina

Bajji, Sachin, Virat Kohali & Suresh Raina

Bajji, Sachin, Virat Kohali & Suresh Raina

DISCLAIMER : I FOUND MOST OF THESE PHOTOS ON A YAHOO GROUP “FUN ON THE NET”. THESE PHOTOS ARE NOT FLICKED BY ME. IF THE OWNER OF THESE PHOTOS HAS ANY OBJECTION PUTTING THEM ON MY WEBSITE, PLEASE LET ME KNOW, I WILL REMOVE THEM IMMEDIATELY.

easily creating name based virtual hosts in apache

Check if your /etc/apache2/ports.conf has following two lines

NameVirtualHost *:80
Listen 80

Create two directories in /var/www
# mkdir /var/www/{foo,bar}

These two directories in /var/www/ will serve as a document root for our two test sites foo.com and bar.com respectively

Create index.html file in each of these two directories and put some html code in it.
e.g.
I am foo.com
I am bar.com

Put entries in /etc/hosts
You need to also put 2 entries in your /etc/hosts file since we are testing it on localhost. If you are doing it on a server then make sure you have respective A records in DNS.
Open /etc/hosts in your favourite editor and put following two entries at the bottom of the file without disturbing original contents of file

127.0.0.4 foo.com foo
127.0.0.5 bar.com bar

Just make sure that above IPs are not already in use in same file …if any of them is in use, then for your entries you can
use any IP in 127.x.x.x range.

Create virtual hosts
Now create two files, “foo.com” and “bar.com” in /etc/apache2/sites-available/
Contents of foo.com

ServerName foo.com
ServerAlias http://www.foo.com
DocumentRoot /var/www/foo/


Similarly create bar.com with following content


ServerName bar.com
ServerAlias http://www.bar.com
DocumentRoot /var/www/bar/

Enable newly created sites
# a2ensite foo.com bar.com

Reload Apache
# service apache2 reload OR # /etc/init.d/apache2 reload

Open your browser and put “foo.com” in address bar .. you should be able to see the contents of /var/www/foo/index.html file
Repeat same step for “bar.com” as well to confirm that your setup is working

Enjoy!!

MongoDB – Replica Set

Here’s a good tutorial on Replica-Set on MongoDB website http://www.mongodb.org/display/DOCS/Replica+Set+Tutorial

In this tutorial, in “Replication” section tutorial asks to create a document on PRIMARY server.

db.messages.save({name: "ReplSet Tutorial"});

After creating a document on PRIMARY if you hit

db.messages.find()

in MongoDB shell the result is displayed. But if you switch to SECONDARY and execute same command to check if replication is working, you get following error.

uncaught exception: error: { "$err" : "not master and slaveok=false", "code" : 13435 }

The reason is stated here : http://www.mongodb.org/display/DOCS/Querying#Querying-slaveOk

So all you need to do is hit this command

db.getMongo().setSlaveOk();

That’s it. Now “db.messages.find()” should work on SECONDARY as well.

Enjoy!!!

ktorrent country flags

How to get country flags in Ktorrent

I love to see country flags in Ktorrents peers tab. Though the database is not much accurate, the flags look nice. 🙂

I upgraded the KDE few months back and came to know that flags are no more shown in Ktorrent. After some googling I found that one should have `kdebase-data` and `libgeoip1` packages installed. Also in Ktorrent ,`infowidget` plugin should be active.

I had both packages already installed and the plugin was also enabled, but still flags were not visible.

The reason behind this is mentioned in README.Debian provided with KTorrent package. So after reading it, I read README.Debian for libgeoip1 package and solved the problem. 🙂 Enjoy.

Install libgeoip1 package
# aptitude install libgeoip1

Create a directory
# mkdir /usr/share/GeoIP/

Run script provided with libgeoip1 package
# cd /usr/share/doc/libgeoip1/examples/
# ./geolitecountryv4.sh
# ./geolitecountryv6.sh

DONE!!!