Switch focus to web page from Firebug Console/Firefox Web Console

While working with Firebug's Console or Firefox's Web Console, you have to constantly keep switching focus from the web page to the respective command line and back, using the mouse. This gets very repetitive and tiring, real fast. If you are like me, then you have probably figured that (thankfully) there are keyboard shortcuts to focus the command lines of the respective consoles.

Switch to the respective consoles

In case you didn't know the shortcut keys, here they are:

  • For Firebug's Console, the key combination is Ctrl + Shift + L
  • For Firefox's Web Console, the key combination is Ctrl + Shift + K

Note: In the present stable version of Firefox (Firefox 27), the above key combination toggles the Firefox Web Console. In future versions of Firefox — probably starting from Firefox 30 — the behaviour will change to: always focus the command line (similar to the current behaviour of Firebug). Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=612253

Now that we are able to focus the command lines of the respective consoles, another problem arises.

Continue Reading...

Tips and Tricks - 2

Well, it's been a while since I posted the first Tips and Tricks article. Most of the following stuff was gathering dust (of the digital kind) ;-), waiting to be formalized into a post. So, I finally took pity of it and came up with this post.

1. Handling zombie processes

To reap (can't kill a zombie) a stubborn zombie process, you can do either of the following:

  • Using kill, send SIGCHLD (signal number 17 on Linux) to the parent of the zombie.
  • Send SIGCONT (signal number 18 on Linux) to the zombie process itself.
2. Safer output redirection in Bash

To prevent files from being overwritten by any redirection operator such as >, >& or <>, put either of the following in your ~/.bashrc:

set -o noclobber

-- or --

set -C

This can help you from accidentally overwriting files. If you decide that you do want to go ahead with the operation, you can use the >| operator instead.

Continue Reading...

Interesting Links - January 2014



Continue Reading...

Interesting Links - December 2013

So, while I had dropped the idea of posting Interesting Links for some reasons, heavy reader demand (read: 1 reader :P) forced me to be back with this post type. From now on, I'll try to post these monthly or bi-monthly, depending upon feasibility.

Also, a very happy new year!

So here's my first post for 2014.

Linux / FOSS:

  • Multiprocess feature coming to Firefox soon.
  • ownCloud 6 brings collaborative ODF editing along with other new features.
  • WordPress 3.8 was released, and it brought with itself a great new design for the dashboard, better support for different device types, a new default theme and much more.
  • A new point release of Debian 7, i.e., 7.3, was made available.

Continue Reading...

Anacron like jobs at arbitrary intervals using dcron

A little while ago, I had to set up a backup script using cron. dcron is my favourite cron implementation.

I have been using dcron since a few years, and it has served me well. But this time, my requirement was a bit complicated.

What I wanted to do was: Run the backup script every two days.

Now, this may sound simple to achieve using any cron implementation. Fair enough, it can be done by specifying something like the following in a crontab:

0 8 */2 * * script.sh

The above syntax will execute the given script at 8 AM, every 2 days.

So, what's the catch?

Well, the catch is that this method has a huge limitation — which is — that it requires the computer to be running at the time specified, or the job will be missed.

I need to run the script on my personal computer, which isn't powered on all the time. So, this syntax was ruled out.

Continue Reading...

Aria2 and GNU Paste: The perfect team

I have been having internet speed problems lately (as always :P), which kept me from updating my Arch Linux system. Today I decided to go ahead and update the system anyway, only to find that the download speeds were excruciatingly slow. As always, whenever I need to update my system with a bad internet connection, I fall back to aria2.

Downloading from multiple servers with aria2

Somehow, I was getting decent speeds with concurrent outbound connections, so I decided to use multiple mirrors to download the packages. aria2 supports downloading a file from multiple sources (and protocols!) at the same time.

So, I decided to generate three download lists using three of my favourite mirrors. I first did:

# pacman -Su --print > mirror1.list

And, after editing pacman's mirror file: /etc/pacman.d/mirrorlist, I generated mirror2.list and mirror3.list in the same fashion.

The problem at hand

Now came the real problem. When using an input file with aria2 (as I was about to), aria2 expects all the sources for a file to be specified on the same line and separated using a <Tab> character.

So, I had three input files containing urls, and they needed to be merged linewise in the above mentioned fashion.

Continue Reading...

Get total number of commits for a repository using the GitHub API

I was trying to get the total number of commits for a repository using the GitHub API. After scouring over the documentation, I was unable to find a way to do that. Searching the web revealed nothing, as well.

So, I came up with the following *hackish* solution.

Note: I'll be using the following repository for illustration:


Obtaining hashes for the commits

We need the hashes of the first commit and the latest commit to get the total number of commits.

Hash of the first commit

Obtaining the hash of the first (initial) commit is tricky, as I couldn't find a way to do that through the API.

So, to do that you'll either have to visit the web interface of that repository on GitHub or clone that repository and find it through git log. The good thing is that under normal circumstances, the hash is unlikely to change, so you can save it and be done with it.

In our case, the hash of the first commit is:


Note: If you need to get the hash of the first commit regularly, then this post is of no use to you. As you can simply clone the repository everytime, and find the number of commits locally.

Continue Reading...