Made a merge on a wrong branch?

If you have made a wrong merge, use the following command to undo the merge.

git reset –hard HEAD^

That’s it! Simple but effective…

Note: Don’t forget to add the ^ sign at the end of the command.Β It’s a known as a “Relative Commit Reference” and indicates “the parent commit”.

Remove all unused kernels

As you know, everytime there is an update for the kernel, the new kernel is installed while the old one is not automaticaly uninstalled, after several kernel updates you will find a large list of old kernels in the start grub menu . So if we got no problem with the new installed kernel, we can just delete the old ones as they occupy space which is a wastage of resource.

Well there are multiple ways to find the kernel version:

Print the kernel release with uname:

$ uname -r

Print all the information related to kernel:

$ uname -a

List Linux Kernels with dpkg–debian package manager:

$ sudo dpkg -l | grep linux-headers | grep ii

$ sudo dpkg -l | grep linux-headers | grep ii | awk '{print $3}'

Well following is the magic command which removes unused kernels:

$ dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

There is an extensive use of regular expressions and pipe characters which is very well explained below.


The “HOW” of Google Summer of Code

This article is dedicated to all my friends / aspirants who aspire to be GSoCcers (those who get selected for GSoC (an acronym for Google Summer of Code)). I decided to blog as I thought a lot of people needed to be enlightened. So for your benign information, I had been selected for GSoC 2014 under BRL-CAD ( the U.S. Army Ballistic Research Laboratory (BRL) – now the United States Army Research Laboratory ). So I would like to take the privilege to share my experience which might help you to get selected for GSoC. First of all I would like to mitigate the level of apprehension that getting selected in GSoC is neither a Herculean task nor a rocket science . It’s just a few steps of the ladder that you have to climb consequently and patiently.
Alright to be specific, first of all you have to find your skills / interests. Skills can be like having a good acquaintance with C / C++, PHP etc. and interests can be like Web Development, Desktop Application Development, Cyber Security etc.
Okay now that you have recognized your skills and interests we have to see for the organizations which are compatible with your skills and interests. Organizations or communities are the groups which work on certain projects. Mozilla, Linux Kernel, WordPress etc. are the examples of organizations. Then you have to find the organizations or communities under GSoC which work with such projects. You may find them either by googling. However I would recommend to use some other search engines too like , bing etc.Β 
or using the search filters in this link.
Suppose I know C++ so I would have filled C++ in the “tags” filter (but you have to login to your google / gmail account) and the organizations will appear which work in this technology. You might have seen BRL-CAD organization (I chose this last year) after searching for C++.
Let’s climb the next step. You have to join the community you have chosen. You may do this by subscribing their mailing lists (Search for Mailing List of BRL-CAD or any other organization you want to participate in). Introduce yourself, your skill-set and your intended area of work in the mailing list (just compose a mail and send it off). Also join the community on its IRC channel (Again you have to shed off your habit of spoon feeding and search for IRC (Internet relay chat). :)). However if still you need help peep here. πŸ˜›
After joining the community on their IRC channel you may start interacting with them that you want to work with their community. It’s better if you ask them something specific that you want to work on a specific project rather than asking “What project should I work on?”. Do a plenty of homework before interacting with the community; homework in the sense, see what were the previous years’ projects etc. However don’t hesitate to interact as they all are more than happy to help. πŸ™‚
Next step is to choose the project you wish to work under that community. Most of the times it is suggested by the community however students can also propose some project if they have something good in mind that can help the community.
Then brace yourself up and start shooting the bugs down in the project you have selected. Solve the bugs and submit them in the form of patches (patches mean small improvements in the existing code). This is the most crucial thing that will be counted perhaps because this shows both your capability and devotion.
And the last step you have to climb is writing up a proposal of the project you wish to do in GSoC and submit it when application process starts. The proposal should include all the details like how you fragment the complete project and spread it over a time scale of 3 months. However, a format will be given for writing the proposal. Decide your targets / milestones that you will achieve while coding. Now you are almost done, just recite a few hymns to praise the God or rely on your luck till you get selected. (y)
To keep a track of what is going on, see the following website. You may see timeline of events which have occurred or which are yet to occur. This the most useful asset. πŸ˜€
I wrote this post because I was also guided. πŸ™‚ Keep contributing in open source. It’s fun and it’s awesome. πŸ˜€
For further queries you may ask (just leave a comment), I will try to help. πŸ™‚

Change the β€œdevice name” in System settings in Ubuntu

Do you want to change your device name as shown in System settings (as shown in the screenshot below) ?

Alright, we will change our device name with the all powerful sed commmand. For your information sed is a special editor for modifying files automatically. If you want to write a program to make changes in a file, sed is the tool to use. For more information on how to use sed refer to .


Run the following in your terminal:

sudo sed -i 's/present-host-name/new-host-name/' /etc/hosts
sudo sed -i 's/present-host-name/new-host-name/' /etc/hostname

Now check your present-host-name by cat /etc/hostname or hostname .

EnJoY! πŸ˜€


Recover / Undelete lost data using TestDisk

Hi people of Earth! Are you really worried / vexed because you have accidentally lost your data / partition on your storage media? Don’t worry, just chill! TestDisk has come to your rescue from planet–Open Source. πŸ˜› So I (friend of TestDisk) will guide you through the steps how to get help from the alien–TestDisk in getting / recovering your lost data (mind it! TestDisk is really fond of getting admired, so go ahead and don’t forget to admire it;-)).

Okay let’s begin recovering your data. Let’s DELETE the data with our own hands and then we will UNDELETE (recover) it. Don’t worry, in this tutorial we will delete some data from our pendrive (just for experimental purpose) and then will recover it. Alternatively, you don’t need to delete the data if your data is already deleted. πŸ˜›data1

Step1: Create a log file:

Let’s us DELETE some data from our pendrive. In my case I have two files in my pendrive (one song and one picture). Now go ahead and delete your files either from terminal or graphically (as you prefer). Now let’s call our alien-friend, TestDisk for help, type “Testdisk” in terminal and press Enter. Now it will ask for selecting any one of the three options viz [ Create ], [ Append ], [ No Log ]. For now you may select [No Log]. Create and Append are used for recording the work of TestDisk in a log file.Create a log file
Step2: Select a media:

Now this will show all your partitions and mounted drives (pendrive) or any other storage media which is mounted. Now select the media from which you want to recover the data and >[Proceed] (press Enter).Select a media

Step3: Select the partition table type:

Now select the partition table depending upon how partitioning has been done in your storage media. For simplicity, TestDisk gives a HINT below which may indicate the automatically detected partition table type. In our case it has detected Intel. Select and press Enter.Select the partition table type

Step4: Select Advanced:

Now TestDisk may ask for selecting from options viz [Analyse], [Advanced], [Geometry], [Options], [MBR Code], [Delete] and [Quit]. Out of these select [Advanced] and press Enter.Select Advanced

Step5: Select Undelete:

Now it may ask for selecting from options viz [Type], [Boot], [Undelete], [Image Creation], [Quit]. Select [Undelete] as we want to undelete (recover) our deleted files.Select Undelete

Step6 : Select the files to be Recovered:

Now it will show the deleted files in RED. Now you can select the file with “c” (lowercase) to copy the current file, “a” (lowercase) to select all files and “C” (uppercase) to copy the selected files (you may type capital “C” by pressing shift+c).files to be Recovered

Step7: Select the destination where marked files will be copied:

Now select the destination where marked files will be copied. Use arrows keys. The two dots (..) will take you one directory back. Keep pressing enter until you reach your desired destination. For simplicity we will select destination, Desktop.destination

Step8: Final Move!

Now press “C” (shift+c) to copy the selected files onto your destination (Desktop in our case). Now it will start recovering your deleted files. Now if your data to be recovered is in gigabytes (huge amount) go and get some coffee for yourself and leave TestDisk alone for doing its job. πŸ˜‰ After the recovery is done it will display “Copy done!” in GREEN. That it! Your data is restored. Cheers! Now keeping press “q” untill you quit.

Final Move!Wait! Don’t forget to admire TestDisk (in the comment section below) as it was mentioned above it’s fond of getting admired. πŸ˜›

Install IRC chat client, The Quassel in Ubuntu 14.10, Ubuntu 14.04, Ubuntu 12.04

Quassel IRC, or Quassel, is a graphical, distributed, cross-platform IRC client, introduced in 2008.[1] It is released under the GNU General Public License for Linux and Unix-like operating systems, OS X, and Microsoft Windows. Since the release of Kubuntu 9.04 (Jaunty Jackalope) Quassel is Kubuntu’s default IRC client.[2][3] Quassel uses the Qt application framework.

Since it might not be installable via “apt-get” or “software center”, we can add “ppa”, update our local packages repositories and install.


$ sudo add-apt-repository ppa:mamarley/quassel
$ sudo apt-get update

$ sudo apt-get install quassel


$ sudo apt-get remove quassel

Ubuntu Fresh Install: RestrictedFormats?

Have you installed a fresh Ubuntu? If YES! then you might be experiencing a few problems in listening to the music, watching videos and surfing the web as in problems with Flash, Java and so on. Don’t worry just feed your terminal with the following commands and all will be well. πŸ˜€ This is just because the patent and copyright restrictions (see Ubuntu License Policy) complicate distribution of software to support non-free formats.

For Ubuntu:

sudo apt-get install ubuntu-restricted-extras

For Kubuntu:

sudo apt-get install kubuntu-restricted-extras

For Lubuntu:

sudo apt-get install lubuntu-restricted-extras

For Xubuntu:

sudo apt-get install xubuntu-restricted-extras

To play DVDs, you need to install libdvdcss by entering the following in a terminal:

 sudo /usr/share/doc/libdvdread4/

ENgulfing the tech

So as usual these days I am trying to engulf as much tech knowledge as I can. After HTML, CSS, PHP, it’s the time of JavaScript to be engulfed. is really cool. I am in love with the way it tutors. Apart from this, I am thinking ofΒ  implementing this knowledge to make some productive project which will be of some use.

I am also trying my hands upon SQL injection, Cross Site Scripting (XSS), MD5 encryption and one more thing which is really cool but for now let it be a secret. πŸ˜‰ I will try to write the tutorials of each of the above once I do some considerable amount of work on these. But for now I have to leave because I don’t want to skip my breakfast in the hostel mess like the past few days. πŸ˜›

How to Install Firefox 34.0.5 on Ubuntu

Firefox 34, which includes eight security fixes, is the first version since Mozilla announced it was dropping Google for Yahoo as its default search engine.

What’s New:

  • Default search engine changed to Yahoo! for North America
  • Default search engine changed to Yandex for Belarusian, Kazakh, and Russian locales
  • Improved search bar (en-US only)
  • Firefox Hello real-time communication client
  • Easily switch themes/personas directly in the Customizing mode
  • Wikipedia search now uses HTTPS for secure searching (en-US only)
  • Implementation of HTTP/2 (draft14) and ALPN
  • Recover from a locked Firefox process in the “Firefox is already running” dialog on Windows


  1. Download Firefox from the Firefox download page to your home directory.
  2. Open a Terminal and go to your home directory: cd ~
  3. Extract the contents of the downloaded file: tar xjf firefox-*.tar.bz2
  4. Close Firefox if it’s open.
  5. To start Firefox, run the firefox script in the firefox folder: ~/firefox/firefox

Now your firefox should have opened. You may also create an icon on your Desktop to run this command.

EnJoY! πŸ˜€

God gifts those who gift themselves

Heard such saying before?Β  Yeah this is the enhanced version of the saying which is based on my self realisation. Today I read about the Internet’s Own Boy,Β  Aaron Swartz. He was the one who with the grace of God learnt to learn at a very young age. His father introduced him to the computers when he was about three. He wrote his first program in BASIC when he was 6. Astonishing? Then listen some more. He developed a website called infobase when he was 12. It was a website like WikiPedia for which he got scolded at school as the teacher disliked the idea to allow everyone to edit the content. Now the best part is WikiPedia was developed 5 years later. Startled? πŸ˜› You should be. And the title of the post indicates that you need to gift yourself with the gift of hardwork to continue receiving gifts from the Almighty which is what done by the people you call Legends.

Well for today this much of his golden tale is enough. I will try to be a good story teller by tomorrow too. :P.

Well I shared this story because I wanted to emphasise on the fact that good books good people good thoughts keep your spirits high and elated. I would personally acknowledge that the boy I told story of inspires me a lot. When you encompass yourself with the ideas and thoughts of such people you actually get motivated and pumped up to excel in life by emulating them which is actually too good a deed. So in my opinion to stay focused devoted determined towards your aim, surround yourself with good thoughts good people.

Other than this today I stayed immersed in the ocean of PHP and C++.