Saturday, December 28, 2013

Sending SMS alerts when the power goes out with apcupsd and Amazon SNS or Plivo

[Edited 2014-08-09 to add mention of Plivo (and pointer to sample script), and mention the NOLOGINDIR in the default Debian config.]

This post recounts how I set up SMS alerts to tell me when the power went out in my apartment. I set it up on a Debian testing box. It's very simple. (And you get to use the cloud, whatever that is!) Note that none of this will work if your ISP's networking gear is dead too! This probably won't protect you against a widespread mains outage, unless you're on DSL, or your ISP really cares.

I haven't tested it in a real power outage yet, and I haven't tested suitability of SNS for this kind of use-case. If you care a lot about this working, go read someone else's instructions.

Building blocks:

  • An APC uninterruptible power supply that powers to your server and any networking gear the server needs. (In my case: dumb switch, and firewall. The cable modem has its own battery, inexplicably.)
  • An Amazon Web Services account. We'll be using SNS. OR, a Plivo account. (Plivo is much simpler.)
  • A phone that can receive text messages. If you're using Amazon, it must be able to receive text messages from shortcodes. (That means no Google Voice if you're using Amazon. As of 2013-12-28 I confirmed that it cannot receive text messages from Amazon's shortcode, 30304.)
  • A linux server. It needs some software:
    • The AWS CLI, if you're going to use Amazon to send notifications; OR, the plivo python module, if you're going to use Plivo to send notifications.
    • apcupsd. Note the warnings on their page about UPS compatibility. I used a Back-UPS RS 1300G and it worked fine.

Plivo vs Amazon

Plivo is much simpler to set up. However, you must rent a dedicated phone number from them for $0.80/mo (as of Aug 2014), and there is no "subscriber" model like Amazon, which means you must send text messages to each recipient individually.

It depends on what you want. I only want to message myself (1 number) when something happens, and I use Google Voice -- so Plivo is a better fit for me.

Plivo Setup

(Skip if you're using Amazon.)

No detailed instructions, but it is not complicated: go to and sign up for a phone number.

This is the script I wrote to send text messages -- it is just a simple modification of one of Plivo's examples. I put calls to this script in the event scripts in /etc/apcupsd/:

Amazon SNS Setup

(Skip if you're using Plivo.)

Create a new topic in SNS. Note that it is uniquely identified by a string that Amazon calls an ARN. Add an SMS subscriber, and enter your phone number. Wait for the confirmation text message on your phone, and confirm. You may wish to also add an email subscriber.

Verify: Send a notification from the SNS console, by hitting the "Publish" button.

Amazon SNS Client Setup

(Skip if you're using Plivo.)

You'll have to be able to publish to SNS from the command-line. Set up a new user by going to the Security Credentials page. Create a new user. Note the credentials amazon has generated.

Add permissions to the new user so it may publish to the SNS topic you created before.

I gave my user "Publish" permissions to all my SNS ARNs, since I'm using SNS exclusively for this exercise. You can craft these permissions in the interface by clicking on your user -> Permissions tab -> Add User Policy -> Policy Generator. You can also select Custom Policy and paste in the following policy:

  "Version": "2012-10-17",
  "Statement": [
      "Sid": "Stmt138826832300",
      "Effect": "Allow",
      "Action": [
      "Resource": [
Install the Amazon command-line interface. Because we'll be calling aws from apcupsd, configure aws as the root user:
# aws configure

Enter the credentials you created before. I picked the region my SNS topic is in as my default region.

Verify: Test sending a notification from the command line with aws sns publish (substitute the ARN of your SNS topic for your_arn below):

# aws sns publish --topic-arn=your_arn --message="something happened on ${HOSTNAME}"

You should get a text message!

apcupsd Setup

Install apcupsd via your package manager. Configure it for your UPS by editing /etc/apcupsd/apcupsd.conf. Two notes for Debian, (1) comment out the line "#NOLOGINDIR /etc" unless you want apcupsd to prevent logins after a power failure, and (2) you must subsequently edit /etc/default/apcupsd to set ISCONFIGURED=yes and manually start the service.

Check that it can talk to your UPS by running apcaccess.

There are interesting configuration files in /etc/apcupsd -- they define what happens on various power events. The relevant one here is /etc/apcupsd/onbattery, which is run when the UPS switches to battery power. With apcupsd 3.14.10, the file looks like this (comments stripped out):


MSG="$HOSTNAME Power Failure !!!"

   echo "Subject: $MSG"
   echo " "
   echo "$MSG"
   echo " "
   /sbin/apcaccess status
exit 0

I edited the file to add the bold text below (again, substitute the ARN of your SNS topic for your_arn):


MSG="$HOSTNAME Power Failure !!!"

   echo "Subject: $MSG"
   echo " "
   echo "$MSG"
   echo " "
   /sbin/apcaccess status

# either amazon SNS script or plivo script follows:
aws sns publish --topic-arn=your_arn \
        --subject="${MSG}" \
# or: /path/to/ "${MSG}"
exit 0

I just use the subject line because text messages must be short. I figure the hostname will give plenty of context.

(If you've set up your mail daemon so mail can send messages to non-local addresses, you may wish to change the value of SYSADMIN to your email address as well. Note that doing that and adding your email address to the SNS topic will result in duplicate emails -- one verbose, one short.)

Restart the apcupsd service.

Verify: Pull the plug of your UPS out of the wall! You should get an anxious message from apcupsd.

Final Notes

Again, none of this will work if your ISP's networking gear is dead too! This probably won't protect you against a widespread power outage.

apcupsd is by default configured to shut down the machine when the UPS' battery has 5% or 3 minutes remaining.

Monday, December 16, 2013

HP iLO 4 free feature set

I bought an HP Proliant MicroServer Gen8 as a home server, and I've been playing around with iLO. I couldn't find a clear description from HP about which features of iLO require a "iLO 4 Advanced" license and which don't. Since I have only worked with totally commodity or super-weird hardware at home and work, I had no assumptions about iLO or IPMI in general. So I kept track of some of it and wrote it down.

Here is the information I've collected so far:

  • My HP MicroServer Gen8 machine, purchased Nov 2013, came with iLO 4 v1.30.
  • You can reboot the machine gracefully by simulating the power button being pressed, or immediately (as if you held down the power button).
  • You can change some boot/power settings that are also in the BIOS. The ones I found interesting were: whether to turn on when power is restored (after being lost), delay when turning back on, priority of boot devices.
  • You can see the values of the various sensors on the system: fan speed, temperatures. There's even a fun visualization:
  • You can view bunch of configuration information (which RAM slots you've filled, what processor you have, etc).
  • You can turn on SNMP. I'm not sure what's exposed.
  • You can manage users manually and set ssh keys via the web interface.
  • You can connect via ssh and, I assume, do all or most of the above.
  • You can connect via ssh and connect to a virtual serial port. (Remember to run getty on the port from the other end!)

You cannot do the following without a license:

  • Insert virtual media.
  • Set up remote syslog or email alerts.
  • Connect to the remote text console. (Separate thing from the virtual serial port!)
  • Manage users via centralized mechanisms. (LDAP, etc.)

From the machine itself, you can reboot the iLO module and change some of its network configuration via ipmitool. This post has more information. There are official HP tools for interacting with the iLO module from the main machine as well, but they're packaged for major releases only, so they're not necessarily a breeze to install if you're a debian testing ("jessie", as of now) hipster like I am.

This is not exhaustive. This is just everything I've seen so far.

Aside: After screwing up the network configuration of the iLO module once in the first half hour of playing with it, it was tremendously useful that I could reboot the iLO module from the main machine. (Not just the other way around!) I'm now thinking that it would be useful if all my machines could restart each other.

Using the Ansible plugin in Vagrant 1.2.2

I didn't find much reference to this online, and it hung me up for quite some time: The Ansible plugin for Vagrant has changed fairly substantially between version 1.2.2 (which is the version currently packaged by debian testing/jessie) and version 1.4.0 (which is covered by the online docs).

The top things I've noticed are:

  • No inventory file is automatically generated.
  • The inventory_path option in 1.4.0 was called inventory_file in 1.2.2.

Since the documentation for Vagrant is not too comprehensive to begin with, I think it's best to just ignore it and read the source. For comparison, source of config.rb at 1.4.0 vs config.rb at 1.2.2.

Friday, November 15, 2013

Checking the directory port on a Tor relay

SITUATION: You have a tor relay. You say to yourself, "self, is my directory server working?"

SOLUTION: Check this URL:

Where $RELAY_ADDRESS is the, uh, address of your tor relay. Remember the directory port number. The default is 9030.

Also, reference:;hb=HEAD;f=dir-spec-v2.txt, search for "/tor/".

Thursday, October 10, 2013

TLS Authentication for Munin with easy-rsa

Munin is cool. However, by default, it sends everything in plaintext, and relies on silly schemes like subnet whitelisting for authentication. However, it can use TLS.

Most of the info is here: Read that first.

The munin wiki assumes you know how to make openssl certs, though, which I don't. Here's the cheat-sheet for that (this all assumes you are using tls paranoid):

First, set up 'vars' file the way you want. This should be in any fairly standard easy-rsa tutorial. I set mine up to use a non-standard 'keys' directory, because I already had OpenVPN keys in the default one. I have my munin-specific easy-rsa vars file in 'vars-munin':

$ . vars-munin
$ ./clean-all # this creates index.txt
# default answers to everything:
$ ./build-ca
# default answers, then sign=yes, commit=yes
$ ./build-key $munin_master
$ ./build-key-server $munin_node

The key is that the you use build-key (a "client" certificate) for the master, and build-key-server (a "server" certificate) for the node.

You can check which one a given cert is with:

$  openssl x509 -in some-cert-name.crt  -text -noout | grep -A 1 "Netscape Cert Type:"

(The difference is the value of nsCertType, I believe. I know very, very little about this. There is some explanation here.)

If things aren't working, see the instructions on for debugging a single plugin on a single host -- that will let you test the TLS authentication in a simpler, faster way.

[Addendum: I see, according to these debconf13 slides, munin 2.0 introduces ssh as a transport. That would have been way better. D'oh! Well, munin 2.0 isn't in ubuntu 12.04 anyway, so I learned something.]

Wednesday, October 9, 2013

Online translator for phonetic (NATO/FAA) alphabet

I couldn't find any simple, quick translators for the NATO Phonetic Alphabet (you know, "Alpha! Bravo! Charlie!"), so I wrote last night. (Yes, I tried, but it was taken.)

You can use the form, or you can use nice short URLs like

It's not fancy, but it appears to mostly work. It's as much an excuse to learn Go on AppEngine and use a little Bootstrap 3 as it is an actual webapp. Code is on GitHub.

Friday, September 6, 2013

Using GNU screen for serial terminal connections

The Soekris net5501 has a serial port which has the following settings, according to the manual [PDF]:

The connected ANSI/VT100 terminal or terminal emulator should be set for 19200 baud, 8 databits, no parity, 1 stop bit, no flow control.

To use these settings in GNU screen, type:

$ screen /dev/ttyUSB0 19200 8N1

/dev/ttyUSB0 is the name of the serial device in this case. You probably have to run that command as root to connect to the serial device.

[---ranting below, ignore ---]

Incidentally, the Soekris net5501 manual is an example of how a manual should be written for a real computer. After reading it I am actually reasonably informed about the machine, and have a good idea of what I can do with it. It's great!

A typical consumer device, on the other hand, would come with a half-page color brochure showing happy people standing next to the device with all its lights blinking, and a CD full of adware.

Thursday, September 5, 2013

Managing devices with the ip(1) command

Useful if you need to manually set your IP address, netmask, and gateway. (Such as when there isn't a DHCP server around, or the DHCP server is broken, or if you accidentally set some device's IP to be outside your local LAN's configured IP range.)

These examples will use wlan0 as the example device. I am changing the IP address from to


Turn on the device

# ip link set dev wlan0 up

Get device's current IP address

# ip addr show dev wlan0
2: wlan0:  mtu 1500 qdisc mq state UP qlen 1000
    link/ether 84:3a:4b:0a:cc:cc brd ff:ff:ff:ff:ff:ff
    inet brd scope global wlan0
    inet6 fe80::863a:4bff:fe0a:cccc/64 scope link 
       valid_lft forever preferred_lft forever

Optional: Remove the device's old IP address

# ip addr del dev wlan0

Give the device a new IP address

# ip addr add brd + dev wlan0

The "+" is shorthand, and auto-sets the broadcast address based on the IP address and netmask. E.g., the "+" above means ""

Give the device a default route

# ip route add default via dev wlan0

Sunday, September 1, 2013

Backup options for Linux laptops, Part Two (Conclusions)

This post summarizes my conclusions about all the backup options I investigated. (tl;dr: CrashPlan.) In part one I attempted to articulate my requirements for backup software.

My expected use case (for evaluating prices) is backing up about 100GB of data, most of which changes very infrequently, from 2 machines. One is a laptop, which means it will be frequently suspended, have a frequently interrupted internet connection, etc.

This isn't meant to be a general guide; it's so I don't forget why I made the decision I did. And it's all just, like, my opinion, man.

This is all circa Fall 2013.


CrashPlan (closed-source, includes storage service)


Multiple backup destinations, both to your own machines and to CrashPlan's servers. However, using a machine as a backup destination requires running CrashPlan on the destination machine.

Can use a separate password for backup recovery specifically (which is used to encrypt the actual key), so you're not constantly entering your "secret" credentials into CrashPlan's web interface. Of course, if this is your goal, you have to be mindful to never use the web restore interface. Security FAQ.

Can configure headless machines, but it is clunky (though not actually difficult). No command-line interface.

Large java binary


Pricing model is more product-based than I'd prefer (e.g., it includes "number of machines backed up" as a restriction) rather than a direct reflection of CrashPlan's costs (storage, bandwidth).

Pricing page. "Family plan" allows backups from 10 machines, and unlimited storage at $12.50/mo if you buy 1 year up front.

Duplicity (open-source, configurable storage services not included)


Uses tar files for actual backup data, and GPG for encryption. Supports multiple backends, including your own machines, and stuff like Amazon S3. Uses scp, etc, so does not require running any special software on backup destination machines.

Makes a distinction between full and incremental backups. As I understand it, this means periodically making new full backups to avoid having to apply an increasing set of incrementals as time goes on. This means maintaining two full backups.


No built-in storage service, so the only pricing model to consider is e.g., Amazon S3. Assuming one full copy of 100GB backup set stored in Amazon S3 regular redundancy (pricing page), it's $0.095 per GB per month.

Assuming the need to keep 2 full backups at 100GB each, which is somewhat pessimistic estimate, that's $19/mo, plus some cost for incrementals.

SpiderOak (closed-source, with storage service)


GUI and command-line (usage, install notes) interfaces. Configuring software without the GUI is easy.

No option to keep full backup on one of your own machine. Does have option to cache data (not metadata), but that means you can't restore just from local machine -- it's designed as an optimization to speed up large restores, not as a second backup location. You can use a machine as a cache without installing special software (it uses sftp).

Client software is fairly slim.

They also have some articles on their site explaining their approach to data security, like this one, and this one on their signup process.


Pricing page. Pricing model is perfectly reasonable (though coarse-grained): $10/mo for 100GB and unlimited computers. $20/mo for 200GB, and so forth.

SafeKeep (open source, no storage service)


Designed for backing up to other machines you own. No option to use S3 as a backup destination.


No built-in costs. However, to achieve the same level of redundancy as options that provide their own storage service, or can use Amazon S3, you can look at the cost of owning a virtual machine with 100-200GB of disk storage. This can be had for about $10-15/mo, based a few minutes of searching. See ServerBear results for virtual machines with at least 100GB of storage, and Backupsy.

I'm including this just to make sure I'm not passing up a sweet deal -- I have no desire to run another machine. I will happily pay a premium to avoid it.

Obnam (open-source, no storage service)


Uses GPG to encrypt data. Can both push and pull backups (whereas most systems only push). Designed for backing up to other machines you own. No option to use S3 as a backup destination.


No built-in costs. See note about dedicated virtual machine for storage above.

Tarsnap (visible-source, includes storage service)


Encrypts backups with a key generated on the client. (So the key is also required to restore.) Track record of being transparent about security bugs.

Backup only to provided storage service, not local machines.


$0.30/mo per GB. (Well, 300 picodollars per byte-month.) Pre-paid model, which makes storing small amounts of data reasonable (no rounding up to $0.01, etc). So, $30/mo for 100GB.


I'm not willing to sacrifice the ability to make backups both to a local machine (for speedy backups, and insulation from any service-wide outages), and to a remote managed service (remote so I can add a second site, managed because I don't need another machine to maintain).

Only CrashPlan satisfies this requirement. As an added bonus, it is also quite cheap.

Its downsides are that it requires running CrashPlan itself (which is a bit porky) on backup destinations, and the wonky pricing scheme.

Sunday, August 25, 2013

Backup options for Linux laptops

I'm evaluating backup options. This is a post to outline my requirements and wishlist, so I don't forget them, and so I can be a little more organized in evaluating options.

I'm shopping around because my super-cheap one year intro rate on CrashPlan (from their Black Friday sale last year) will end in a few months, so I'm re-evaluating my options for backups.


  1. Linux compatibility.
  2. Encryption. At least as an advertised feature. Everything I really care about is already encrypted on-disk anyway.
  3. Multiple endpoints. An option to keep some backups on a machine I control (on my local network, for fast restores), some backups in my butt the cloud (for reliable access, and off-site-ness). Flexibility is not a big deal here -- just an option to send everything to 2 places is fine.
  4.  Support for headless machines. I will back up servers. I will not run X on them. (CrashPlan, for example, is fine here. Configuring headless machines is a pain, but it's doable.)
  5. Support for laptops. A laptop has a network connection that comes and goes, spends large amounts of time suspended, etc. Things have to work if the machine doesn't happen to be powered up at 3am on Sunday.


  1. Easy headless configuration. Full-featured command-line interface. (CrashPlan, for example, does not have this.)
  2. Small resource footprint. No giant Java binaries.
  3. Encryption, for real. This means, likely, visible-source with a good track record of reporting vulnerabilities. CrashPlan, for example, has encryption, but the fact that they have a web interface means they can read my backups if I enter my encryption password there.
I am finding that requirements #3 and #5 rule out most minimalist options (rsync + shell scripts, etc), and requirements #1 and #4 rule out most consumer options. (In CrashPlan's favor, I've already done one large [~60GB] successful restore with it.)

More on multiple endpoints: I'm looking for an option that lets me pay a monthly fee to back up to some provider's servers (like CrashPlan and Tarsnap offer).  I'm also considering something that requires me to run a server on some virtual machine somewhere, but from what I've seen so far, that's likely to be more expensive. (Lots of backup options for $15/mo, not a whole lot of virtual machines with 100GB storage for that price.) Gets complicated, though. Tarsnap, for example, would be $30/mo for 100GB.

Sunday, June 30, 2013

The songs in the movie "Passenger Side"

Silver Jews - Punks in the Beerlight
Smog - Hit the ground running
SNFU - cannibal cafe
Chad VanGaalen - mini tvs
mekons - ordinary night
squirrel bait - kid dynamite
buided by voices - the goldenheart mountaintop queen directory
beethoven - good guys and bad guys
the nils - call of the wild
young marble giants - final day
volcano suns - jak
superchunk - driveway to driveway
dinosaur jr - freak scene
DOA - fucked up ronnie
unrest - isabel
the mountain goats - wild sage
camper van beethoven - we saw jerry's daughter
islands - rough gem
asexuals - be what you want
leonard cohen - suzanne
mac mccaughan - you don't have to make me feel better
the mekons - last night on earth
chad vangaalen - graveyard
evan dando - hard drive
wilco - passenger side

(according to the credits)

Friday, June 14, 2013

Using the terminal bell as an urgency hint

Covered here:

I'm going to try this.

Update: Works like a charm. As a note to future-me:
1. Remember  to re-source your .tmux.conf, or quit all tmux sessions.
2. While pre-occupied with remember #1, remember to re-merge settings in ~/.Xdefaults.

Saturday, April 6, 2013

Ubuntu 12.04 LTS on a Thinkpad X1 Carbon

Very uninteresting install because everything just works by default, with no configuration: USB-to-ethernet dongle, wireless, audio, webcam, microphone, etc.

Specific machine is the i7/8GB RAM X1 Carbon:

$ sudo dmidecode -s system-version
ThinkPad X1 Carbon
$ sudo dmidecode -s system-product-name


Immediately on startup there's an error message relating to the display. After about 1 second, the message disappears and the system keeps booting. (I'm not sure if this is a UEFI vs. BIOS thing. If it kept me from booting, I'd look into it. But it doesn't.)


The trackpad is the only thing that's a little fiddly. There are discrete physical buttons only above the trackpad, and the trackpad has some hidden buttons you can access by pressing down on the trackpad itself, like the newer MacBooks. (You can also tap, but I've disabled that.) This means the cursor has a tendency to move around a little when you press down on the trackpad to click. I set HorizHysteresis=50 and VertHysteresis=50 with synaptics to settle it down a little. Full command line for synclient (run in my ~/.xsession):

synclient MaxTapTime=0 PalmDetect=1 
  PalmMinWidth=85 PalmMinZ=17298 VertEdgeScroll=0 \ 
  HorizHysteresis=50 VertHysteresis=50

(PalmMinWidth and PalmMinZ are cargo-culted from previous configs. They may not be necessary at all.)


The non-hardware-related install notes from the Ubuntu 12.04 LTS on a Macbook apply here too. (Sections "Window Manager", "Networking", and "Power Management".)


This part is just a rant:

The most infuriating thing about this laptop is the power supply -- the Thinkpad X1 Carbon uses a rectangular 90W 20V power connector, while other ultraportable Thinkpads (X201, etc) use a round 90W 20V connector. While it's understandable that the X1 Carbon uses differently-shaped connector for purely physical reasons (the round ones would be nearly as tall as the laptop itself), there is no good reason why Lenovo wouldn't make a pair of cheap dongles that convert between the two connector styles (one for each direction).

(If they were classy, they'd include a pair of converters with the X1 Carbon itself, but I'd never truly expect that from Lenovo. I'll settle for the converters existing.)

Mythical part # 0B47046 exists on third-party sites, but I haven't found one that claims to have it in stock, and knows nothing about it.

The sad truth is that while this is extremely frustrating, but not frustrating enough to make me buy something else. Apple, with whom Lenovo is obviously trying to compete, handled similar transitions much more gracefully.

[Updated at 2013-04-08 17:59 EDT.]

Thursday, March 14, 2013

Exporting OPML from NetVibes

I use NetVibes, and have recently tried to export my feeds as OPML, and noticed that it generates invalid OPML. The OPML 2.0 spec states:
A missing text attribute in any outline element is an error. 
NetVibes' <outline> elements look something like this:

<outline title="Netvibes Blog" type="rss" xmlUrl="" htmlUrl=""/>

It's very easy to fix -- just add a new "text" attribute with the contents of the existing "title" attribute. It trips up some other OPML importers, though.

[Edit: I wrote a little python script to fix this problem specifically:]

Thursday, February 28, 2013

Side-by-side diffs with diff(1)

diff -y

That's it. (Fuck tkdiff, eh?)

[Learned here. I hated on tkdiff all on my own, though.]

Monday, January 21, 2013

Android App Idea: Simple, Subway-Friendly Commute Timer

This is not a new idea.

There are already several "commute timer" apps available for Android: The usual pattern I see is that they track your location over your commute to and from work, and give you arbitrary statistics based on that. (Total time, plot your path on a map, best/worst time, slow parts, fast parts, etc.) From here, they add various conveniences like starting automatically based on time+motion. Someone mentioned wanting an app like this in a forum post.

I found iCommuteLess and a paid app simply called Commute Timer for Android. They're both right up the alley of location-based ubiquitous computing (shout-out to ActiveCampus!), which makes me feel warm and fuzzy inside, but they're not what I want.

The apps I've found seem to use the GPS extensively, which doesn't work if you're underground. (On, say, a subway.) They (or, at least, iCommuteLess) are also filled with bells and whistles (read: bugs). Phone screens are underpowered and small, and lots of features means a slow, clunky app unless you are very clever and very, very good at UI design.

What I'm imagining is similar to what the forum poster described: a glorified stopwatch. You can start the timer, mark a midpoint (just like the "split" function on a stopwatch), and stop. It saves the history for you in some easy-to-read format. You can do all the number-crunching you want on the file. I specifically would note when I leave my apartment, when I reach the train station near my apartment, when my train arrives, when I leave the train station near work, and when I'm at my desk (plus the reverse).

No GPS means you lose all ability to automatically start and stop, but it also means less battery life (and of course the ability to use the things on trains).

I'll keep looking for something, and if I don't find it, I might have a go at writing it myself. I've been looking for an intro-to-android-programming project for a while.

Of course, if someone reads this (ha), and implements it first (double-ha), that's even better. You can't own ideas, man...

[Edit, 2013-01-03 21:12 EST: This post is already the second hit on Google for "android commute timer app". This doesn't bode well for there being an already-existent gem out there, just waiting to be discovered. Dammit.]

Wednesday, January 16, 2013

Git: Picking which diffs to stage

git add typically stages files on a file-by-file basis, but you can stage single diff pieces (hunks) of a file with the --patch (or -p) option to git add.

It will open an interactive console application to let you pick which hunks to stage.

Explained in more detail here: