Generate C interface from C++ source code using Clang libtooling

Using Clang libtooling for LLVM to generate C interface from C++ source code.

Read On →

How to wrap a system call (libc function) in Linux

For one of my research projects I had to wrap linux system calls and redirect them to another thread. In Linux system calls are not invoked directly, but rather via wrapper functions in glibc[man 2 syscalls]. The glibc wrapper is only copying arguments and unique system call number to the registers where the kernel expects them, then trapping to kernel mode and setting the errno if the system call returns an error number [man 2 intro]. Read On →

National Geographic Photo of the day Downloader for Linux

National Geographic's Photo Of the Day I am a fan of National Geographic photos on their site, and I also get bored of by my desktop background after a while. So I decided to create a script to download National Geographic photo of the day, and using it as my desktop background. I am using it over Gnome3 (I am using Fedora as I think it’s more stable than Ubuntu, and I like Gnome3 way better than Unity), but if you are a Unity user it should work for you as well. Read On →

What Might My Resume look Like If I Were a Computer !?

The other day I was about to update my resume, and this crazy question came to my mind: What might my resume look like if I were a computer ? And This is the result. (Best viewed in Chrome and Firefox). Well, I am aware that I would not wake up one morning finding out I turned into a computer. Also, I am not sure if one day I turn into a computer, I would look for a job. Read On →

Mercurial on Bluehost

I had to install a mercurial repository on bluehost for one of my projects. The good thing about mercurial is that it allows you to access your repository through http, and it is an ideal version control system for shared hosts. I googled around for it, and I found a couple of instructions available (this and this). But they are outdated, and probably worked with earlier versions of mercurial. So I decided to rewrite the instruction of installing mercurial on your shared host (specifically bluehost):


Update your bash profile, add/modify these 3 lines:

Read On →

SSH to VirtualBox 3 FreeBsd Guests

This post is based on “Howto: SSH into VirtualBox 3 Linux Guests” by Stuart Colville, which I have updated to work for FreeBSD Guests: In older versions of VirtualBox one had to use a bridge interface to make this work. However, in newer versions; a virtual interface can be added to the Host by default, which make it way easier to access the guest machine through the host. Usually, you have a primary network interface which uses NAT adapter, that one is needed for connecting to the Internet. Read On →

Some Notes on Facebook Hacker Cup Qualification Round

Monday, January 10 was the last day to submit your answers to get qualified for Facebook Hacker Cup. It started from January 7, and lasted for 3 days. There were three problems presented on the competition website, to be solved by participants. Problems were provided with sample input and output, and there were no time limits to browse through the problems and to develop your code. To answer each problem, competitors had to download an input and submit their output, yet they only had 6 minutes, after they downloaded the input, to submit their answers through the form provided. Read On →

The Power of Free

I am no coffee drinker, I prefer green tea and herbal tea over coffee. I rarely break this habit, only if I am too sleepy or really crave coffee. But once I was in a gathering in Davis Center (at University of Waterloo) and they were offering free coffee and donuts. All of a sudden I found myself socializing and drinking coffee without having any good reason for breaking my habit, I could not justify my behavior at the time. Read On →


There are moments in life when you have to make a big decision, however, your emotions and ego block your mind. You cannot think clearly, and you see everything the way you want them to be, but the reality is on the exact opposite side. If you just rely on yourself and float in your thoughts, you are gonna drown at the very bottom of these thoughts. There is no way out of your doubts and uncertainty, it either makes you go crazy or never let you get in touch with reality. Read On →

See ID

I used to be asked to show my ID every time I was paying by my credit card, and yes you are right, I did not sign the back of my credit card (That is how it works in Canada, they are taking it to the next level for entering a PIN number though). Today I was asked to show my ID again, but I noticed no one has asked me to show my ID for last two months. Read On →