Saturday, 29 December 2012

Minimizing all windows to show desktop in gnome 3.5.4

I Just upgraded to gnome 3.5.4 from gnome 3.4 on Ubuntu and now I feel that it is one of the most buggiest gnome versions ever :(
Gnome shell extensions are one of the best things ever for me especially when gnome came up with installing extension from their website. But unfortunately for Gnome 3.5.4 almost no extensions in their website support it :'( . And it is extremely hard to install gnome shell extensions from their source.
One of the most annoying thing is that "Hide all normal windows" feature doesn't seem to work. And bug while changing brightness still not fixed.
So I have decided to manually fix each of the bugs myself for now.
Today I will show you how to enable "Show Desktop" or "Hide all normal windows"

Open Terminal and install xprop and xwit

sudo apt-get install xprop xwit 

Download the Gist file which i have created or copy from below and save it as
Loading ....
Then open Keyboard shortcuts and create a Custom Shortcut

Then give a name to the shortcut and in place of command give the link to the script which you just downloaded. Make sure that that file is executable. If not change it using file properties or use chmod.

Now assign some key for it preferably Super+D

If you don't  like doing all those there is a docklet called "Show Desktop" for Docky which still works pretty well if you don't mind using your mouse :P

Saturday, 15 December 2012

Make a bootable usb for windows using DISKPART

It has been some time since i came to know about this method and I really don't remember from where I came to know how to do this.
Although there are many software with GUI which can do exactly the same thing as this, I prefer to do it via command line simply because i don't want to depend on some dumb software to do such a petty task :P
 The idea is to make a primary partition on you usb drive and put the contents of the windows os onto the usb drive. After making the bootable usb you can simply boot from usb to install windows.


1.   Go to Start->run
2.   Type 'cmd' to open the command prompt
3.   In command prompt type DISKPART
4.   Then type LIST DISK. This should display all the active disk drives.
5.   Now select the usb drive from the list. Say Disk 1 is the one ! type SELECT DISK 1
6.   CLEAN
7.   Now create a primary partition on your usb drive. CREATE PARTITION PRIMARY
10. Now format your usb drive to ntfs. FORMAT FS=NTFS
12. EXIT
13. Now copy all the contents in the windows iso or disk to usb drive( DONT COPY ISO ITSELF)
14. Now boot from usb to install from the usb drive

Monday, 3 December 2012

Recover grub using ubuntu live CD

Sometimes when you have both windows and other linux it is possible that windows somehow replaces  the bootloader with its own bootloader like NTLDR or MBR and this does not detect other operating systems. For example when you partition your hard drive using windows your bootloader is also replaced. Today I will show you how to recover grub using ubuntu live CD.
The key here is to mount the linux file system to a particular location and mounting all the required devices, virutal files..etc to the mount point and then changing the working root to the mount point and updating the grub file (grub.cfg or menu.lst)

  1. Boot with your ubuntu live CD and select try ubuntu.
  2. After loading ubuntu, open Terminal
  3. Now say your linux file system exists in /dev/sda1 (use any application like 'Disks', 'Gparted', 'fdisk' to find it)
    Mount all the required folders to your linux file system.

    $ sudo mount /dev/sda1 /mnt
    $ sudo mount --bind /proc /mnt/proc
    $ sudo mount --bind /sys /mnt/sys
    $ sudo mount --bind /dev /mnt/dev
    $ sudo mount --bind /usr /mnt/usr
  4. The key here is to change the working root to the one in your installed linux
    $ sudo chroot /mnt

    If you get any error here like '/bin/bash not found.' or something, it maybe because /bin and /lib are not there. So type the following commands to bind the existing /bin and /lib with the ones at /mnt and retry chrooting to /mnt (type the above command again):
    $ sudo mount --bind /bin /mnt/bin
    $ sudo mount --bind /lib /mnt/lib

    If the above problem still persist try mounting /dev/pts also (it has something to do with signature keys)
  5. Now simply update and install grub to replace the existing bootloader

    $ grub-install /dev/sda
    $ update-grub or $ update-grub2
    If you get any error in the above step try this:
    $ grub-mkconfig -o /boot/grub/grub.cfg

  6. Now reboot the system
Note: Sometimes it may happen that the version of the grub installed might be old. So to replace it with the original version simply boot using your linux and repeat step 5 with root permission.

Some people say that they get this error when the do update-grub :
/etc/grub.d/00_header: 28: .: Can't open /usr/share/grub/grub-mkconfig_lib

The reason is that some ubuntus have the required file for updating grub in a different place. So copy it to correct location:
$ sudo cp /usr/lib/grub/grub-mkconfig_lib /usr/share/grub/
and then update-grub

Saturday, 1 December 2012

Increase size of root partition in Linux

Your root partition is out of juice and you cant afford to redo the installation procedure? Well today i am going to teach you how to solve this problem.
There are two ways of solving this problem.

1. Extend partition using gparted

Install gparted.
In ubuntu:
$ sudo apt-get install gparted
In fedora
# yum install gparted
Then resize your root partition to get more space for it using gparted.

Note: This is risky and will not work on certain kind of partitions. If the above didn't work use second method.

2. Using soft (symbolic) links

Soft links are equivalent shortcuts in windows but these are more powerful. Here we can move files to other partition and create soft links of the files to their original places. However make sure that the other partition is always mounted. See this if you want to know how to auto mount devices.

There are certain files which are not very crucial but are necessary for some application to perform
for example ~/.cache folder has all the cache of applications including browsers..etc. Music,Video, Downloads, Documents are other such folders.
  1. Move all the folders to another partition, say it is /media/Ambusher/.
  2. Open terminal and create soft links
    $ ln -s /media/Ambusher/cache ~/.cache
    $ ln -s /media/Ambusher/music/* ~/Music/
    $ ln -s /media/Ambusher/videos/* ~/Video/
    $ ln -s /media/Ambusher/documents/* ~/Documents
    $ ln -s /media/Ambusher/downloads/* ~/Downloads
  3. Similarly create soft links for other folders also.
Now you would have freed up a lot of space for your root partition.

Sometime you may have to delete all the soft links in a folder. To remove all soft links in a folder do this:
find FOLDER -maxdepth 1 -type l -exec rm -f {} \;
For example:
find ~/Pictures -maxdepth 1 -type l -exec rm -f {} \;
Note: Soft links won't work if the disk partition type is FAT 16/32 or WIN 16/32 but works perfectly fine on NTFS
Have a nice day!!

Increase your internal memory of your Android phone

I have seen people struggling to install apps on their android due to the fact that they have less internal memory. Today i will show you how to increase your internal memory i.e i will show you how to use your SD card as your internal memory
There are two ways of doing it one the noob way(easy and safe) and the other geek way(difficult and risky).
Anyway for either of them you have to do this

  1. BACKUP YOUR SD CARD as all contents on the SD card will be lost.
  2. Download clockwork mod for your phone. Just Google it :P . And then place it in your SD card (don't unzip it).
  3. Reboot to recovery mode. It is different in different phones. In my phone (Samsung Galaxy Y) while starting the phone i have to hold the power up+home button+power button to go to recovery mode.
  4. Click on install zip from SD card. Note that volume buttons must be used to go up and down in the menu and home button to select.
  5. Select (clockworkmod file which you downloaded)
  6. Now CWM will open. Go to advanced.
  7. Select Partition your SD card 
  8. Select how much you memory you want to allocate to your phone. Don't select more than 2048.
  9. If you don't want swap select 0 for swap( swap will speedup your phone to some extent but not necessary ).
  10. Reboot phone
  11. Download Link2SD from Google play and select the format to ext4. If it shows some error retry selecting ext3. If that also doesnt work try ext2. If that also doesn't work go to Mt. Everest and throw your phone. Just kidding :P

Noob way

Simply use Link2SD to create links to your apk, dex(dalvik-cache) and cache files. And enjoy with more apps :P

Geek way

Do something like this (creating softlinks part) on your phone!! This will make your phone hard to manage but much much efficient than simply using Link2SD.

Setup apache, PHP, MySQL, phpMyAdmin on ubuntu

Today i will show you how to setup apache, PHP, MySQL and phpMyAdmin on ubuntu


Express Install

sudo apt-get install apache2 php5 mysql-client mysql-server php5-mysql

Then restart the apache server
sudo /etc/init.d/apache2 restart or sudo service apache2 start

You are done!! If you want to do it step by step do this:

Setup apache


Type this in terminal
$ sudo apt-get install apache2

If you find any problem at any stage try restarting the apache server like this
$ sudo /etc/init.d/apache2 restart

Setup PHP

Type this in terminal
$ sudo apt-get install php5

Your htdocs are present in /var/www/ you have to be root to change/create files by default. To fix this
$ sudo -i
# cd /var/
# umask 0000
# chmod +rwx -R www
# chown <your username> www
# chgrp <your username> www
# exit

Note: You may have to do this sometimes in the future also

Now edit /var/www/index.php and add anything in php
Open browser and type localhost as url and check whether it works

Many people asked me how to see the error log of PHP. To see use this command:

tail -f /var/log/apache2/error.log

Setup MySQL

Type this in terminal
$ sudo apt-get install mysql-client mysql-server

Note: You will be asked to enter password for your database. Enter a password and don't forget it as it is pretty important

Connect PHP and MySQL

In order for PHP to access MySQL do this
$ sudo apt-get install php5-mysql

Setup phpMyAdmin

Download phpMyAdmin from here.
Now extract contents and move phpMyAdmin to /var/www/

Open /var/www/ and change following lines

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

Now open localhost/phpMyAdmin on your browser

Run anything on startup in ubuntu

Sometimes we might want some set of things to happen on startup. If it is a simple application/script we can simply add to startup applications. However this fails if we need to be root to run that. Today i will show you how it is done.
Say I want to mount a set of disk drives on startup.

  1.  Open Terminal and type
  2. Type the set of commands you want to run on startup in this file. Here it is
    mount /dev/sda2 /home/alse/Ambusher
    mount /dev/sda3 /home/alse/C
  3. Save and close the file. Now change permissions of the file.
    $ chmod +rwx
  4. Then move it to /etc/init.d
    $ sudo mv /etc/init.d/
  5. Add to rc.d
    $ sudo update-rc.d defaults
Now will run on startup.

Now I will show you how to remove something which you have already added
Suppose say i want to remove from rc.d. Type
$ sudo update-rc.d -f remove


Now you can just execute the script by adding in /etc/rc.local

Friday, 30 November 2012


Glutrix is an awesome action game made by us for our Computer Graphics project. It is made using OpenGL in C++. However we were not allowed to use any of the inbuilt functions coz the main reason behind the project was to learn how graphical object are constructed from scratch i.e considering point as our base object.  Still it turned out to be pretty decent.
It is now open source and the source is available here
Fork it->edit it->redistribute it with more fun

How to play

It is a two player game where:
Player 1 has a drawing board where he can draw any object using any of the tools available and that object will turn into an obstacle for Player 2. Suppose he finds a weakness in player 2 he can store that drawing and can re-spawn it again and again. Player 1 has to make use of the fuel he has efficiently. More the number of points he uses to construct the obstacle more fuel is consumed. The game speeds up with time making it difficult for both players but it will become more difficult for player 1. Hence he has to finish off player 2 as fast as possible.

Player 2's job is simple he can jump and evade the obstacles made by player 1 or he can shoot the obstacles out of his way. Even player 2 has limited fuel. The jumps he performs consumes some amount of fuel and the bullets he shoots consumes considerable amount of fuel. If he is hit by an obstacle he will loose some health. For every 200 counts player 2 gets a shield which absorbs some amount of damage when he is hit.


1. Linux (Ubuntu preferred)
2. Libraries gl.h,glut.h (got by installing freeglut)
3. xdpyinfo (if not there modify
4. g++
5. mplayer(if not there modify the code with aplay)

How to install

Type these commands in the terminal after going to that directory:
$ chmod +x install 
$ ./install

How to just run

Type this command in the terminal after going to that directory
$ make