Sunday, May 27, 2012

Backing up Gmail

  1. Generate an application-specific password for your Google account. (You are using 2-step verification, right?)
  2. Use BaGoMa to run a backup.
    python bagoma.py -e <email address> -d ~/Backup/Gmail/<email address>
    
  3. Set SpiderOak* to back up the ~/Backup directory.
  4. Relax.

TODO: Run BaGoMa on a schedule.

* Referral link - you get 1GB free, I get 1GB free.

Friday, May 25, 2012

Quick Python web server on localhost

Python's SimpleHTTPServer is great for serving files from a directory without the hassle of setting us a proper web server.

$ python -m SimpleHTTPServer

But by default it listens on all network interfaces. If you only want to listen on localhost then you'll need to write a short script.

import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler

SimpleHTTPRequestHandler.protocol_version = "HTTP/1.0"
httpd = BaseHTTPServer.HTTPServer(('127.0.0.1', 8000), SimpleHTTPRequestHandler)
httpd.serve_forever()

Adapted from an article at Linux Journal.

Wednesday, May 23, 2012

Using Notepad++ to edit Subversion commit messages

You can set the Subversion editor with the SVN_EDITOR environment variable. Unfortunately, if you have other documents open, Notepad++ will edit your commit message in the existing process. The new process launched by Subversion will exit immediately, leading Subversion to complain:

Log message unchanged or not specified
(a)bort, (c)ontinue, (e)dit:

The trick is to open Notepad++ in a new process with the -multiInst option.

set SVN_EDITOR="c:\Progra~1\NotePad++\notepad++ -multiInst"

Once that option is provided everything works correctly.

Via SVNForum.

Wednesday, May 9, 2012

Where to buy PC components in NZ

After searching around I found this helpful thread at GP Forums. The thread gives ratings for the reliability and service of each retailer. The ratings are updated regularly. Top retailers at the time of posting are Computer Lounge, Ascent, Mighty Ape and Paradigm PCs.

A couple of comments from me:

  • I'll have to check out Mighty Ape for online purchases in NZ. They sell a lot of other stuff too: books, board games. I noticed they also list other sellers' prices on there site, a very Amazon move.
  • I have a long history with Ascent. Most of it is great, although their reputation has recently been somewhat tarnished for me. Their policy seems to be to dispute any return made after the manufacturer's warranty is over. This goes against the rights granted by NZ's Consumer Guarantees Act. Under the Act consumers can expect their purchases to last for a reasonable time, no matter what the warranty says! However I suspect CGA disputes are not unusual among computer retailers—Dell sounds particularly bad! On balance I think Ascent are probably still one of the better ones out there. I was just disappointed after 10 years of great experiences. In the end they did give me a refund.

Thursday, May 3, 2012

Accidental Git commit

I've realised my last post helps when you commit the wrong files or the wrong message, but still want to commit. Sometimes (or quite often for me) you accidentally commit when you're not ready. In that case what you really want is…

git reset --soft HEAD~1

Via Stack Overflow.