Pratyush - A <GeeK>!!!

These are few of the bash commands I often find useful:

z: Z allows jumping (cd) into frecently (i.e. frequently and recently) used directories. Insted of doing cd /home/pratyush/websites/project_name each time, I can now simply do z project_name. Z supports tab completion too. Link to Z library.

ps -u <username> -o pid,rss,command | awk '{print $0}{sum+=$2} END {print "Total", sum/1024, "MB"}': When accessing remote servers using shell, I often need to check the list of scripts running and the memory they are consuming. This command does exactly that. It is a sort of minimal task-manager. I found this command here.

php -S localhost:8888 -t .: Though I am not a PHP fan (anymore), this command serves the current directory using a live php server. This comes handy to tryout a local wordpress installation by just extracting the package.

python -m SimpleHTTPServer 8080 is a Python alternative for starting a live server from current directory to serve the files.

du file/path -chs: du is the disk-utility command. This command shows the total size of any directory. -c is for total, -h is for showing humanize file sizes and -s for showing only the summary. I often use this command on web-servers to find the size of file-system caches.

ssh-copy-id [email protected]: This appends the public key to the remote-host for password-less ssh logins.

mysqldump -u username -p --all-databases > alldbs.sql: For creating a backup of all the mysql databases.

mysql -u username -p < alldbs.sql: For restoring all the databases from the dump.

Both of the these mysql commands are high on performance. These come handy for creating a backup snapshots of databases.

I found these two commands here.

ssh -D 31500 [email protected]: This turns the SSH client into a SOCKS proxy server. It provides me a VPN on the fly. So if a website refuses to open, or is restricted to a particular country, I run this command and then update the proxy settings in Firefox as below:

1. Enable proxy in firefox.
2. Enter "" for "SOCKS Host"
3. Enter "31500" (or whatever port we chose) for Port.

Full documentation for this trick is available here.

howdoi: HowDoI provides answers to programming questions from command line. Thus instead of opening a browser and getting distracted in web, I can now simply type in something like howdoi convert csv to namedtuple to get the leads.

I usually pass the -ac arguments: -a provides the full text of the answer, -c enables colorized output.

ab -n 100 -c 10 AB is a poor man's website performance benchmarking tool. -c specifies the number of concurrent requests and -n specifies the total number of requests to be sent to a webpage. This comes handy while migrating websites to new servers or when making significant frontend changes.

wget "url" -c: WGET is for downloading files from command-line. I often find the download speeds significantly different in browser's built-in download managers and wget. -c enables the resume support.

There are various other must-know bash commands such as awk, uniq, head which are super-useful in daily work. Akshay has covered them in a brief tutorial here.

These are the websites I use the most based on my browser's frecency:

This post is inspired from S Anand's blogpost.

  • A is for Though I don't shop too much, I usually use Amazon to browse though books and read their initial pages.
  • B is - mostly for checking current stock prices and for keeping a track of latest corporate announcements.
  • C shows one of my favorite tech blogs - Recently, have been visiting it more frequently to check the blog's integration with Discourse. It is followed by, which I use to keep a track of latest scores.
  • D is I love to use the live sharing and commenting feature in Google Docs to collaborate on articles, letters and reports. For other writings, I prefer to use gVim.
  • E is I recently read Strunk and White's The Elements of Style; have been using this StackExchange to follow up with few of the rules mentioned in the book.
  • F is (obviously) The runner-up is - rss reader to keep a track of my favorite blogs. In future I would like to see Feedly climb above :).
  • G is - I love open-source projects.
  • H is - used to manage multiple Twitter accounts including @faltoo and @screener_in.
  • I is - for booking all the train tickets. It is followed by for checking all the movie recommendations.
  • J shows one of my favorite financial blogs It is followed by, which I use to compress images in blog posts.
  • K is - for movies and music.
  • L is localhost - a playground for all my development projects.
  • M is (again obviously)
  • N is - I use it to stay updated with the latest programing developments. Lately, I have been using more of for its better interface.
  • O is - for deploying new test projects for free.
  • P is - a custom domain used for testing different internal projects at different times. It is followed by, used for quickly fixing the photographs.
  • Q is Quora. I am not a huge fan of Quora but it is the only one with Q.
  • R is - a side-project I have been working upon. It is like Evernote but saves everything in your DropBox.
  • S is for - the project that takes most of my time :). It is followed by - my favorite resource to get and provide help.
  • T is - I like to keep track of latest updates through Twitter rather than watching news.
  • U is, an old and the only item in U. Now I like to use Arch.
  • V is, my favorite forum for in-depth discussions on stocks.
  • W is - my webhost for all the production deployments.
  • X is - an old one time item when I used MIUI Rom on my Nexus S.
  • Y is - I love to hear music and watch my favorite channels online.
  • Z has no items.

I celebrated the new year on a vacation with a group of friends. One of the best time-pass was the group game of Werewolf.

Be it a bus journey, waiting at a stop or a late night hangout on a beach, we played Werewolf everywhere. It required only some chits of paper (though we used a playing deck as a better substitute).

It requires minimum 7 players and is best experienced with 10-12 players.

I would highly recommend it to anyone who has a large group, scope to shout, and time to go through the rulebook.

Dhoni's shot in world cup final 2011

Of all the sportsmen, I admire MS Dhoni and Brian Lara the most. Whether India wins or not, I try to hear his words and learn from his temperament. Found this wonderful interview of Dhoni where he talks about the role of mind, and gives advice on how to be a better player. These advice apply as well to other things as to cricket.

What advice would you give to a young player who wants to improve his game?

First and foremost, I would tell him that he must love and enjoy his sport. If he does not enjoy it he would not learn to play the game as quickly or as well as he should. Second, I would tell him to keep things simple. The more he complicates the process the harder it will be for him to improve his game. For example, when he tells himself to watch the ball and play it on its merits, he might have other thoughts like scoring runs or not getting out in his mind.

Those thoughts can break his concentration and prevent him from watching the ball. If he knows that the bowler can bowl an out-swinger, an in-swinger and a good bouncer as well, he has three other things to think about. But the more he thinks about what the bowler might do the more complex and difficult batting becomes.

Third, I would tell him to capitalise on his strengths, improve his weaknesses and recognise his limitations.

A lot of people talk about the problems players face when they have to play in conditions that are foreign to them. For instance, when Indian batsmen who are brought up on slow flat wickets have to play on the fast and bouncy wickets in Australia and South Africa.

When I go to Australia or South Africa I try to be positive and see the visit as a challenge and an opportunity to explore, learn and improve my game. I try not to be negative or worry about the pace and bounce of the wickets or the things that could possibly go wrong.

Learning and improvement take time. When you leave nursery school you don’t expect to go straight into a graduate school. In the following years you slowly improve as a student and when you reach a certain standard you graduate and afterwards go on to higher levels. The same thing happens in sport.

The player should therefore be patient and persistent and he should keep things simple and enjoy his sport. Not only should he enjoy his own performance on the field but he should also get pleasure from sharing his experiences with other players and from creating an atmosphere that helps the guy sitting next to him in the dressing room to perform better.

This is one area where the Indian team is very blessed. The senior players in our team have helped the younger players to learn, develop and perform better. Your individual performance is important but how much better you help your teammate to play better is equally important.

This was just one of the passages from the complete interview. Would try to go through the interview again and again at regular intervals.

I recently moved from Dell Studio to Lenovo's Thinkpad Edge E430 laptop. It is an all-Intel machine and the drivers support is quite good. Initially the touchpad felt over sensitive as the cursor jumped a few pixels on finger lifts. Luckily, it is a common touchpad issue on Lenovo machines and easily fixable.

Create the following config file in /usr/share/X11/xorg.conf.d/50-thinkpad-touchpad.conf (create xorg.conf.d directory if it doesn't exist):

Section "InputClass"
        Identifier "touchpad"
        MatchProduct "SynPS/2 Synaptics TouchPad"
        Driver "synaptics"
        # fix touchpad resolution
        Option "VertResolution" "100"
        Option "HorizResolution" "65"
        # increment noise cancellation factor
        Option "HorizHysteresis" "50"
        Option "VertHysteresis" "50"

Update for ArchLinux: file path /etc/X11/xorg.conf.d/50-thinkpad-touchpad.conf

Section "InputClass"
        Identifier "touchpad"
        MatchProduct "SynPS/2 Synaptics TouchPad"
        Driver "synaptics"
        # fix touchpad resolution
        Option "VertResolution" "100"
        Option "HorizResolution" "65"
        # disable synaptics driver pointer acceleration
        Option "MinSpeed" "1"
        Option "MaxSpeed" "1"
        # tweak the X-server pointer acceleration
        Option "AccelerationProfile" "2"
        Option "AdaptiveDeceleration" "16"
        Option "ConstantDeceleration" "16"
        Option "VelocityScale" "128"

Different Lenovo laptops may require different tweaking. Above works best for Edge series. Other configs are available here.

This method copies the PIP packages locally and uses them for faster installation when starting new projects.

First, download the archives that fulfill your requirements:

$ pip install --download <DIR> -r requirements.txt

Then, install using –find-links and –no-index:

$ pip install --no-index --find-links=<DIR> -r requirements.txt

Starting this new "style-snippet" series to archive snippets of some good designs and their application.

Loved the Cambo font used in the header of the numbers package for Vim.

h1, h2, h3 {
    font-family: 'Cambo', serif;
    color: #333333;

Page 1 / 51 Older posts »