ping is working, but no browsing

Incase you can ping to any website (ping but browsing is not working in your webbrowser while your computer is attached to wireless connection.

Issue following commands:

sudo ip link set wlan0 down 
sudo ip addr flush wlan0 
sudo ip link set wlan0 up
sudo dhclient -r
sudo dhclient


Generate assembly code using GCC

To generate assembly code using GCC, use following command:

gcc -S {XYZ GCC compiler flags} -c test.c

{XYZ GCC compiler flags} –> Feel free to add other compiler options as per your requirement. Above command will generate test.s for assembly code.

To mix C language code alongwith assembly language for ease of code review/understanding, use following command:

gcc -g -Wa,-a,-ad {XYZ GCC compiler flags} -c test.c > test.list

test.list will have C & Assembly language.

auto mount secondary hard-drives

To auto mount secondary hard-drive in ubuntu, you have to do edit /etc/fstab

  • Use list block devices (lsblk) command to determine device,
$ lsblk
sda      8:0    0  475.9G 0  disk 
└─sda1   8:1    0  475.9G 0  part /mnt/tmp
sdb      8:16   0  238.5G 0  disk 
├─sdb1   8:17   0  206.5G 0  part /
├─sdb2   8:18   0      1K 0  part 
└─sdb5   8:21   0     32G 0  part [SWAP]
sr0     11:0    1   1024M 0  rom

Let’s assume that our targeted device is sda1 so we will refer it as /dev/sda1.

  • Use blkid command, to determine UUID of the disk.
$ sudo blkid

/dev/sda1: UUID="2a2037b2-41a1-4c0c-b6ca-be81c40bb091" TYPE="ext4" 
/dev/sdb1: UUID="93431b31-e46c-4ae3-86dc-94fe788d64d3" TYPE="ext4" 
/dev/sdb5: UUID="433d261b-1123-49d0-803d-9057e272e604" TYPE="swap"

Make note of the UUID label of the /dev/sda1, In our case it is 2a2037b2-41a1-4c0c-b6ca-be81c40bb091.

  • Create a folder to mount second hard-drive
sudo mkdir /secondstorage
  • Edit /etc/fstab to have following line
UUID=2a2037b2-41a1-4c0c-b6ca-be81c40bb091 /secondstorage ext4 defaults,noatime 0 2
  • Reboot the machine.
  • Once your second hard-drive is mapped for auto-mounting, you will not find hard-drive icon in Ubuntu launcher toolbar.

-march=native @ GCC

The native Linux/GNU toolchain GCC got an option where you map architecture flag to native (-march=native). It allows compiler to generate optimized code supported by the underlying targeted machine.

To determine which other options are enabled on passing -march=native, use following command:

gcc -Q --help=target -march=native

Following command can be useful too to see help

gcc --help=target -march=native



Git — Change commit author name/email

These commands are tested with git version 2.7.4.

GIT rebase command can be used to change git author name & email address but be careful that it will change commit id so if someone else is using it it will create problem.

git rebase -i -p < commit id of the one commit before your bad commits>


-i is for Interactive mode as we want to deal each commit 
-p is to maintain the git tree otherwise git will flatten the git history and you won't be able to identify the point where git merge is carried out.

Change first column of the all the commit ids exposed via rebase to have “edit” command. Once you have typed edit to all required commits, exit from editor and issue

git rebase --continue

As you are only interested to change author name/email, you can use

git commit --amend --author "Correct Author <>" --no-edit

Keep on issuing these commands alternatively until git rebase is not finished. Once it is done you will find new author name/email.

In case you are interested to push these new commands, use following: Be careful as we are deleting remote branch.

git push origin --delete branch-name
git push origin branch-name



create disk image

You can use Unix dd command to create FAT/EXT formatted disk which can be dumpped to a sdcard too.

  • Let’s assumed that we can 20MB FAT formatted disk:
sudo dd if=/dev/zero of=ramdisk.bin bs=1M count=20
sudo mkfs.vfat fat-disk.bin
  • Mount above created disk image
sudo mkdir disk
sudo mount -o loopfat-disk.bin disk/
  • Use sudo cp commmands to copy contents to disk folder
  • Once you are done with copying, issue
  • Umount the folder
sudo umount disk
  • loopfat-disk.bin image is ready for use. You can use dd command to dump to sdcard too.