Reboot TP-Link router remotely or automatically


using cURL or wget, it’s easy to reboot a TP-Link router from a terminal or command line. Put it in a script and schedule it to run automatically if your router overheats or is flaky:

in OSX (using cURL):

curl --user username:password > /dev/null

If you have wget by default instead of cURL (i.e. most *nix):

wget -qO- --user=username --password=password > /dev/null

Replace username and password with the admin username and password of your router. Replace with the IP address of your router.

If you have Windows, with neither of the above, and don’t want to download wget, try using bitsadmin to create a download job.

Run FileBot headless without Dock icon on OSX


FileBot is a great utility for finding the names and subtitles of downloaded TV shows and movies. I use it as part of a shell script to organise downloaded media files.

Unfortunately, the suggested way to invoke it from the command line is simply to call filebot, e.g. /Applications/ ....

This was causing FileBot to pop up a Java icon in the dock and steal focus, whenever it was invoked which was driving me crazy. Fortunately the solution is simple: Run the FileBot jar directly with the awt.headless set to true. As follows:

java -jar -Djava.awt.headless=true /Applications/ ...

No more annoying icon.

Selecting x items at random from a column in Excel


I wanted to select 300 users at random from a row of 10,000 users in Excel. Really easy, but a bit of a lateral solution: Rather than trying to randomly select each item, just order them randomly instead:

  1. In another column adjacent to the column of user names, create a random number for each row (the formula I used was =RANDBETWEEN(1, 90000)). This won’t guarantee unique values for each item, but it doesn’t matter.
  2. Copy the the column with the formulas and Paste As… Values to another adjacent column. This fixes the nubmers and stops them from updating.
  3. Sort by this third column and take x users from the top. I chose the first 300.
  4. Done

Fixing problems with Dovecot – Postfix mail server after Ubuntu server upgrade to 11.10


The thing that scares me most about server upgrades is the mail server… the thought of having to reconfigure the many interdependent servers and processes involved is horrible.

So I wasn’t pleased to find my postfix-dovecot installation dying on upgrade from 11.04 to 11.10. I couldn’t sent outgoing mail or receive inbound.

Fortunately I wasn’t an “early upgrader”… both issues were easy to find and fix.

Continue reading

IPSec/L2TP VPN on Linode Ubuntu server for iPhone/Android


It’s now easy to set up your own cheap VPN virtual private server that can be used with your mobile devices. Great for accessing resources on private networks, browsing securely, or accessing blocked sites.

This is now much easier than it used to be. Last time I tried to set up a VPN on an Ubuntu server, I had trouble with reconnections and had to manually compile OpenSwan. These all seem to be fixed.

Instructions are already all over the internet, but there are a few extra steps for a default Ubuntu linode in order to get routing to work.

These instructions are tested with Ubuntu 11.04 (Natty), but should also work on 11.10. We will set up an OpenSwan IPSec server with l2tp encryption provided by xl2tpd.

Continue reading