The first thing I want to do when I get a new laptop is install Linux on it. I usually don’t have rewritable CD/DVD handy and have to depend on USB flash drives to install Linux. Surprisingly, documentation for Arch Linux was sparse on this subject. However I looked up how its done on Ubuntu and it worked seamlessly for Arch Linux.Continue reading

Some might wonder, why would you do something like that? Install Unity on Arch Linux? Absolutely blasphemy. But really, I have fallen in love with this combination. Till a couple weeks back, I had been using Ubuntu for close to 4-5 years without experimenting with any other Linux distros. I usually resist the urge to install the alpha releases, but by the time the beta releases start coming out, I’m just itching to get hold of it, irrespective of how catastrophic it has turned out sometimes from the work perspective. So when Ubuntu 12.10 beta2 came out, I installed it. But I was sorely disappointed. Unity kept crashing for no good reason, generally not a very stable system. I know ‘beta’ versions aren’t supposed to be stable etc, but it shouldn’t crash as often as it did. Continue reading

There’s a lot of criticism out there for the Unity Desktop Environment. Strangely I can’t echo the same sentiments. I quite like using Unity (mind you not Ubuntu). Here are a few reasons why and why not.

The Unity Launcher: I have always loved launchers. Back in the days, when I would change desktop environments every second day – fluxbox, gnome, kde, wmaker, etc, one thing was constant. I had gnome-panel (&) start from my xinitrc irrespective of what distribution I used. Also I have never been a fan of taskbars. The Unity launcher marries the traditional launcher with a highly usable taskbar. It had some usability issues when Ubuntu initially switched to Unity, but it’s almost perfect now with AppIndicator Support. I can have upto 15 applications open at the same time and it’s still a breeze to manage them.Continue reading

A lot of Linux distributions are shifting to iproute2 instead of net-tools (aka ifconfig, arp, route). The main reason being net-tools package hasn’t been updated in a decade. However having used the trusted ifconfig, route and arp for so many years, I have never bothered to use ip and hence I now need to Google every time I want to see what my IP address is!

So here’s a short iproute2 primer for net-tools users (like myself).
Continue reading

This post is part of a series of posts where I want to document a bunch of C functions I use for my projects that I have written, collected and modified over the past few years. One of the functions that I use regularly is a string replacement function like the str_replace in PHP. This function replaces all occurences of a particular substring with a replacement pattern. The code for this was borrowed from here. In the original code, a newly allocated string is returned after all the substrings are replaced. I have modified it so that the replacements are made in place.Continue reading

A lot of programs require you to pass sensitive information like passwords etc as arguments to the program. However if you pass passwords as arguments, it will be visible through the /proc filesystem or the ps ax output while the program is in execution. To avoid the possibility of anybody prying on sensitive information, programmers should modify the memory location where the input parameters are stored (argv array), so that it is not visible to any other users, who might have the access levels to see what processes you’re running. Jotted below is some sample code which modifies its input parameters to hide it from the proc file system.Continue reading

Kmscon is a simple terminal emulator based on linux kernel mode setting (KMS). It is an attempt to replace the in-kernel VT implementation with a userspace console. It is similar to the in-kernel terminal-emulator and is based on DRM. Listed below is the procedure to install kmscon in ubuntu.

sudo apt-get install libgles2-mesa-dev libgbm-dev libegl1-mesa-dev libdrm-dev libglib2.0-dev libfreetype6-dev
git clone
sudo ./kmscon --switchvt

The last command will start kmscon on /dev/tty8.

Assigning Google Adsense code to a PHP variable doesn’t work the way you would expect it to. I thought just deleting the newline characters and extra spaces from the adsense code and then assigning the resulting text to a variable should work. However it does not, and I’m not sure why. However what does work is shown below.

$googleadsensecode = '
<script type="text/javascript">
google_ad_client = "pub-123456789";
google_ad_slot = "123456";
google_ad_width = 300;
google_ad_height = 250;
<script type="text/javascript"
echo $googleadsensecode;

The following example does not work.

$googleadsensecode = '<script type="text/javascript"> <!-- google_ad_client = "ca-pub-123456789"; google_ad_slot = "123456"; google_ad_width = 300; google_ad_height = 250; //--> </script> <script type="text/javascript" src=""> </script>';
echo $googleadsensecode