Sunday, 14 August 2011

MacOS: Fast key repeat

I do a lot of coding in VIM, which involves scrolling the cursor around with the keyboard. One thing that bothered me quite a bit when switching to a Mac was the slow key repeat rate in Lion, which makes using keyboard-based editors very cumbersome. Key repeat rate can be configured from the menu System Preferences / Keyboard, but I found that even the fastest setting was still too slow for my taste.

Changing key repeat speed from the command line

I’ve seen the following solution proposed on Mac world, but for some reason it didn’t work for me, but you might want to give it a try:

Everybody knows that you can get a pretty fast keyboard repeat rate by changing a slider on the Keyboard tab of the Keyboard & Mouse System Preferences panel. But you can make it even faster! In Terminal, run this command:

  defaults write NSGlobalDomain KeyRepeat -int 0

You can increase the last value to any integer to slow down the key repeat. A value of 2 corresponds to the maximum speed that can be obtained from the System Preferences.

Setting a flexible key repeat speed with keyremap4macbook

What worked for me was setting a flexible key repeat via the keyremap4macbook application. After installing, you can flexibly set key repeat speed to as fast or slow as you like, as shown below.

I’ve had some trouble getting this to work with Lion’s press & hold menu (the one that allows you to choose variations of a letter, such as umlauts). I recommend switching off press & hold and reenabling key repeat by entering the following from terminal.

    defaults write -g ApplePressAndHoldEnabled -bool false

You’ll need to log out and in again for this setting to take effect.

Saturday, 6 August 2011

MacOS: Force torrents to use only your VPN connection

Using a VPN connection is a popular way to hide your IP address when downloading torrents. Unfortunately, you run the risk of exposing your real IP if your VPN connection drops since your torrent client will immediately reconnect using your default, insecure network connection. This seems to be the standard behaviour in Windows, MacOS, and Ubuntu, and is, in my opinion, a massive security flaw: Once a VPN connection has been enabled, the OS should NOT switch back to an insecure connection until the user has been notified. To my amazement, few people seem to share my opinion, and so I have to find ad-hoc solutions every now and again to make sure that my network activity remains secure when using a VPN.

Windows has a very powerful application-level firewall, which can be used to block any application from using an insecure connection. The process is described in this post. I've also solved the problem in Ubuntu, although I'd have to do some digging to find out how (leave a comment if you want to know).

The last couple of days I have tried to find a way to block torrent downloading over insecure connections for MacOS, and encountered a couple of challenges:
  • The application level firewall of MacOS is a complete joke. (Found under System Preferences / Security & Firewall)
  • ipfw, the ip-based firewall that comes with a mac can only be used to block ALL non-VPN traffic.
  • There seem to be no free application level firewalls for MacOS, although if you have the money to spare Little Snitch seems to be a decent piece of software. (edit: I'm not sure if Little Snitch is powerful enough)
  • My torrent clients of choice, ĀµTorrent and Transmission are not very configurable.
After a lot of searching I finally found a solution using the highly configurable torrent client Vuze (formerly called Azureus).

Step-by-step guide to forcing your torrent downloads to only use VPN on MacOS:
  1. Download and install Vuze. Make sure you do not install the additional software they push on you during the installation process. 
  2. Connect to your VPN service
  3. Open Vuze
  4. Go to Vuze / Preferences / Mode and activate advanced mode. (See picture below.)
  5. In the preferences, go to Connection / Advanced Network Settings. Find the name of your VPN network interface in the text box (e.g., "ppp0"). Enter the name of the interface into the text box "Bind to local ip address or interface". (See picture below,)
  6. Tick the option "Enforce IP bindings ..."
  7. Click save and exit the configuration screen
  8. Try out whether it works: Start downloading some torrent for testing purposes in Vuze, e.g., a Ubuntu installer disk image. The download should only work if your VPN is enabled. If you disconnect the VPN, the connections should fail, and the download should cease.
  9. Success. You have now configured your torrent client to securely download over VPN.

The above procedure is not ideal since it forces you to use Vuze, which is a big fat piece of bloatware, but it will at least make sure that you do not inadvertently expose your IP address when loading a torrent. If you know of a way to force ĀµTorrent and Transmission to only use a VPN in MacOS, let me know.

As an aside, if you use a pptp based VPN you should also consider disabling ip6 to ensure security.

Thursday, 4 August 2011

Sending free faxes to US destinations

For some weird reason, a company recently required me to put an order with them via fax instead of e-mail.

I found this very thorough FAQ, which describes a number of ways to send faxes from the internet via free or commercial services. It seems to be very up to date.

Tuesday, 2 August 2011

Latex: Unmatched braces in tikz matrix node

I just struggled to get some tikz code working which looked approximately like this:
\matrix { a & b & c \\ d & e & f };

This fails to compile with warning:  "Missing } inserted."

The problem turned out to be that the matrix command in tikz always needs to end with a new line, that is:

\matrix { a & b & c \\ d & e & f \\};

LAN Syncing Dropbox between Ubuntu & Windows, Wifi & LAN

My favourite cloud syncing app Dropbox has a nifty LAN syncing feature, which detects when two computers are on the same local network and transfers files directly between them, instead of taking the scenic route via your internet connection.

Unfortunately, this does not always seem to work. In my home setup, I have my Windows 7 box connected to the router via ethernet, while my Ubuntu 11.04 laptop connects via wifi. In this setting, LAN syncing did not seem to work. I "fixed" this problem by connecting my laptop via ethernet and deactivating wifi. Clearly not ideal, but at least I can sync my 2.5gig Dropbox folder without downloading my files at 0.1kb/sec from the Dropbox servers.

August Presentation Clicker LP107T and Ubuntu

A while ago, I bought a wireless presenter from a company called August at amazon. Upon arrival, I found that it didn't work with my laptop running Ubuntu 11.04. I was a bit surprised to find this, since the device basically pretends to be a USB keyboard, and hence should run out of the box on any operating system.

A short search led me to this bug report which explains that the linux kernel patch 2.6.37 inadvertently breaks support for the presentation clicker by adding support for the (rather bizarre) Yurex leg shaking sensor. The two gadgets share the same device ID. Since by default Ubuntu let's you choose from a list of recent kernel versions during startup, a simple fix is to choose a pre-2.6.37 kernel version or update your system in case the problem has been fixed in the meantime.

Bison crashing with memory error:
"bison: double free or corruption (!prev): ..."

After a Ubuntu upgrade I had bison constantly crashing with the following error message:

*** glibc detected *** bison: double free or corruption (!prev): 0x0000000000e139c0 ***

This blog post provided a solution. Simply type the following on the terminal:
sudo apt-get install bison
It seems that I accidentally had the bison++ package installed instead of bison.

I would also suggest:
sudo apt-get install flex
Since I was missing that package as well.

Monday, 1 August 2011

Tracking your 2011 MacBook Air for UK orders

About a week back, I decided to indulge myself and ordered the new 2011 MacBook Air with a i7 custom-to-order (CTO) configuration. I received a shipping notice 3 days after ordering, and have since then spent half my waking time on the Apple order tracking page, only to be stuck with the following, rather vague information:

Estimated Delivery Date (Subject to change)09 Aug 2011 (Subject to change)
Current Delivery StatusIn Transit to Customer - Shipment on Schedule
Carrier Tracking Number
In transit to final destination - carrier details to be updated shortly.
Assigned Carrier
In transit to final destination - carrier details to be updated shortly.

Dammit! I need to know where my MacBook is right now! What's the point of buying a luxury product if you can't indulge your inner 5-year old with pointless requests for information.
A quick internet search reveals that a webpage called apecode is supposed to be the answer to my suffering. Unfortunately, at the time of writing this, apecode is down. Further googling brought me to this thread on a Dutch message board which seems to list a number of logistics companies that Apple is known to use for shipping to Europe.

Indeed, the first link worked out for me: The site at allows you to enter the number that shows up on your order tracking page under "Our delivery reference number" and receive a tracking update. I got the following info:

Criteria:Tracking Number: XXXXXXXXX
Data as of:01-Aug-2011 19:37:18 GMT
Ready for Delivery - #XXXXXXXXXXX
Import Customs Release01-Aug-2011 11:23:00 GMT

It seems my MBA is napping in Heathrow at the moment, together with 231kg of other Apple equipment. Fingers crossed I might get it before the weekend.

If this post helped you out, leave a quick comment. This blog is an experiment to start posting my solutions to all the little everyday problems I solve after an hour of googling in order to speed up the process for other people, so I'm curious whether anybody finds their way here.

Edit: Just for your information. My macbook arrived in Oxford on the 3rd of August, 5 days before Apple's estimate and 2 days after customs release at Heathrow.