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

[][1] 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 was the result. (Best viewed in Chrome and Firefox, if I turn to a computer I will run Unix based systems and IE does not exist in my world). Well, I am aware that I would not wake up one morning finding out I turned into a computer. 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: vim ~/.bash_profile export LD_LIBRARY_PATH=”$HOME/packages/lib:$LD_LIBRARY_PATH” export PYTHONPATH=”$HOME/packages/lib/python2.3/site-packages:$PYTHONPATH” export PATH=”$HOME/packages/bin:$HOME/bin:$PATH” source ~/.bash_profile vim ~/.bashrc PATH=$PATH:$HOME/bin:$HOME/packages/mercurial source ~/.bashrc Create folders (Please note, from now on my assumption is that your web directory is located at $HOME/public_html, please change the related parts if your configuration is different): cd mkdir install_files mkdir packages mkdir ~/public_html/hg mkdir ~/public_html/hg/repos Get Mercurial and install: cd ~/packages wget http://selenic.com/repo/hg-stable/archive/tip.tar.gz tar zxf tip.tar.gz mv tip.tar.gz ~/install_files/ mv Mercurial* mercurial cd mercurial #dont' forget to change the username echo -e "[ui]\nusername=YOURUSERNAME <YOUREMAIL@WEB.com>" > ~/.hgrc make local ./hg debuginstall Running the last command should not show any problems and you would see : Checking encoding (UTF-8)... 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 →

Rationality

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 →

SPDY installation

I am taking a course called “Latency in Communication Systems” taught by Martin Karsten in University of Waterloo. We talked about different aspects of latency in communication systems, there were some lectures from industry (Sandvine, TD Securites, RIM, and SUN/Oracle) about what were the different problems they were facing during their system implementation. I had also presented two papers on profiling and router performance during the course. My course project is the reason I am writing this post, I have to install and evaluate SPDY. Read On →