Recently, in my research, I want to throttle the I/O and network bandwidth of my program so as to show my program is robust in different senarios. In practice, we may also want to limit the resources used by certain programs (rsync, wget, …). Fortunately, this is possible in Linux. Next, I will show how to do it on Ubuntu 14.04. I believe it’s doable on any Linux distributions. For network bandwidth limiting, we will use a program called trickle. Install trickle:

Usage of trickle:

Example: limit the bandwidth for scp under 10MB/s

An alternative for network bandwidth limiting is wondershaper. But I found that tirckle works better. For disk bandwidth limiting, you can use the cgroup[…]

Install tsocks sudo apt-get install tsocks Edit /etc/tsocks.conf sudo vim /etc/tsocks.conf Sample configuration for CSE at CUHK:

Done. Use it with tsocks git pull

Today is Chinese New Year’s Eve, this most important holiday for Chinese. I came back to my hometown, Fuzhou, Fujian, last night. My flight was delayed for 45mins, which is kind of lucky. In the mainland of China, the government disallows people to access Google, Facebook, Dropbox and many other useful services using the so-called Great Fire Wall (GFW). Before I went to Hong Kong, I was always using goagent to cross the GFW. Before goagent, I have also tried to buy ssh or VPN service in the US. Goagent is based on Google App Engine, and because of some limitations of GAE, you have to install some certificates manully before using goagent, which I think it is nasty and[…]

For some reason, I have to install GCC 4.6 on a Fedora 12 server in the department (sadly that I can’t wipe it out and reinstall a latest version of Ubuntu). I believe the following steps [1] are similar in other versions of Fedora or CentOS. First, install necessary libraries:

Then download the source code, configure, make and install,

The GCC will be installed under /usr/local. You can change the install dir by adding –prefix=PATH_TO_INSTALL_DIR on configuration command. To use GCC 4.6 in cmake, set CC=gcc-4.6 and CXX=g++-4.6. You may encounter a fatal error: gnu/stubs-32.h: No such file or directory. [2] This error message shows up on the 64 bit systems where GCC/UPC multilib feature is enabled, and[…]

The default Simplified Chinese input method in Ubuntu is ibus-pinyin, and it really sucks!! SunPinyin is much better. It may be not as good as Sogou or Google pinyin, but it is acceptable… SunPinyin is a statistical language model based Chinese input method, which was firstly developed by Sun Beijing Globalization team, and opensource’d to community with opensolaris project, with LGPLv2 and CDDL dual-licenses. Install it using

The default keys for prev/next page are not -/+. To change the settings of sunpinyin, you can run

This article record how I setup the printer in our office at CSE, CUHK on my Ubuntu 12.04. According to some tutorial, I only need go to Printing -> Add -> Network Printer -> Windows Printer via SAMBA, and install the printer at \NTSVR3\lp120. Actually, I can find the printer at smb:/CSDOMAIN/NTSVR3/lp120, but I cannot verify the authentication with my CSE username and password. I search for solutions in Google and somebody says I should install SAMBA:

Then, everything is OK… But I still cannot figure out why I can find the printer but cannot verify my authentication without SAMBA. Next, I choose the driver HP LJ 4000 PS. But when I print papers to read, I found that[…]

I encounter a problem when I tried to compile the storm-starter project using lein (using Maven internally), because I am behind a fraking proxy. So I add proxy configuration in ~/.m2/settings.xml.