More Detail on Dropbox Backup

As mentioned in yesterday’s post, I’ve taken to backing up the important guts of my server via Dropbox. It turned out to be very easy, and gives me the added benefit of not having to do any sort of versioning: I get that for free with Dropbox. Plus, it seamlessly integrates with my existing backup routines.

So, how do I do it? It’s honestly very simple.

First, I generate some backups. I run these out of cron every morning.

mysqldump -u root wordpress | gzip -c > /path/to/backup/blogdb.sql.gz
tar czf /path/to/backup/apache2.tgz /etc/apache2/*

I do this for my web databases, any important config files, crontabs, etc. (The actual sites are already backed up, since I develop them locally.)

Once they’re dropped off in the backup location, it’s just a matter of having the script come along and copy them to Dropbox. I chose to write it in ruby. Honestly, my code is 90% of what you find in Dropbox’s example. Here it is, in all of its glory:

require 'dropbox_sdk'

# Dropbox app key, secret, token
APP_KEY = 'get your own'
APP_SECRET = 'get your own'
ACCESS_TOKEN = 'get your own'
BACKUP_DIR = '/path/to/backup/'

# Open our Dropbox Client
client = DropboxClient.new(ACCESS_TOKEN)

# Our hardcoded list of files
files = ['list of files to backup']

# For each file, let's upload it
files.each do |filename|
    file = File.new(BACKUP_DIR + filename)

    # Send file to dropbox -- last param tells us to overwrite the previous one
    response = client.put_file('/' + filename, file, true) 
end

That’s it. I don’t really do any error checking (I should, and probably will some day, but I don’t today). I should probably store the key/secret/token in another place, but since my app was created and only has access to one Dropbox folder, and I can revoke access at any time, it’s not too much of a risk. Eventually, when I get really ambitious, I’ll have the files list be dynamic, not static. But for now, it’s less than 20 lines of code to backup important files.

That’s good enough for me.

Remote Server Backup via Dropbox

This site runs on a VPS server sitting out in a data center. I try hard to keep the server reasonably backed up, similar to how I keep my desktop backed up, but it’s something I’ve not been nearly as diligent about.

Previously, here was how I kept my VPS backed up:

  1. Paid daily server snapshot (i.e. I could restore my server to exactly what it looked like yesterday)
  2. Database dumps of my important mysql databases that I would remember to copy off to another server every couple of weeks (i.e. not particularly reliable)
  3. A backup of my important web stuff over FTP and git when I remembered to do it (i.e. not particularly reliable)

So, in the grand scheme of things, not very reliable.

All I really wanted was a simple backup where I could easily get the important files and configs off of the server onto my local machine, so that it would get included with my normal, robust, multi-location backup strategy. The normal method to do that would be rsync, but that means running my machine all the time. Not a big deal for my desktop machine, but that’s also not the machine that gets updated and backed up to Amazon Glacier daily.

Really, what I wanted is to use Dropbox on my server, without having to run Dropbox on the server.

It turns out, that’s pretty easy [1].

There are a few different solutions out there [2], but for me, I wanted a bit of control over it. Dropbox’s Ruby API is really, really easy to use. My total script is about 22 lines (I’ll go into that, in the future). Very simply:

  • I’ve created a Dropbox app that is tied to a single directory in my Dropbox account
  • I’ve got a number of crons that backup data into a location on my server
  • My little 22 line Dropbox script runs once a day and uploads that backed up data into my Dropbox account

So, right there, I’ve now backed up my data daily to Dropbox, which is a big win over what I had before. Even if my computer dies or is turned off for a month, I’m still backing up my data. But, even better, when my various computers are turned on, I’m getting the backed up data synced down to those machines. So, I’m getting multiple copies of my backup data, and that backup data is getting included in the places that those machines are backed up (Time Machine, Glacier, etc.).

I’m not sure why I didn’t think of this before. It took all of about 60 minutes to get the entire thing working, including building the little Dropbox backup app that runs on the server.


  1. If you can write a little bit of code.

     ↩

  2. If you care to Google.

     ↩

Updated NBA Points Created Page

For the 7 people who care, I’ve finally updated my NBA Points Created page [1] to include the 2013–2014 season. Early in the season, the raw numbers clearly favor big men, but that effect should even out over the course of the season. The per–40 numbers are definitely a better barometer for overall value (I think), and at least pass the sniff test.

I’ve not really updated any of the coefficients in the last few years, and it probably could use a slight tweak to reflect the changes in the pace of the game, but as a quick and dirty barometer, it’s at least interesting to look at.

The LinkedIn Conundrum

Every few weeks, I log into LinkedIn and to accept/reject connections and clear out the stupid notices of people who’ve said I can do something well.

(I don’t think the people are stupid. I think the notices are stupid and spammy. Which, I think, you could say about pretty much 99% of LinkedIn’s email communications.)

I clear all the notifications, flags, messages, requests for human blood from LinkedIn and then I notice my profile is out-of-date. As I go to update it, I encounter The LinkedIn Conundrum.

“What’s The LinkedIn Condundrum?”, you ask? Good question.

The LinkedIn Conundrum (or at least, what I see as the conundrum …) is the desire to update your profile so that it at least reflects reality, but then the fear to do so because you don’t want it to look to your colleagues that you’re shining up your resume to look for a job.[1] Some people clearly don’t have this fear, and they update their profile one hundred times a day, outlining every new thing they’ve done in their job (“skills: getting coffee four times a day without anyone noticing I’m away from my desk”). There are certainly others, and I fall into this category, where I struggle over whether to update my profile at all, fearing that someone will assume I’m looking for a job. So instead, my profile stays there, frozen in carbonite, forever out of date.


  1. The corollary to The LinkedIn Conundrum is the same fear whenever you accept the connection of a recruiter on LinkedIn, which clearly makes people think you’re talking to a recruiter, when in reality, you’re just accepting some connection to a recruiter who reached out to you, or you’re using for sourcing. Of course, none of this would be a problem if it was socially acceptable to not connect with everyone on LinkedIn, but that doesn’t seem to be the societal norm. Though, I do, on occasion, not accept a connection, if only to exert some feeble power over the LinkedIn borg.

     ↩

Typhoon: NPR Tiny Desk Concert

I mentioned Typhoon a few posts ago. I think they’ve put out my favorite album of the year, and certainly put on my favorite show of the year (thus far).

Just watch this. If you like music, at all, you’re going to smile. Harmonies, hand claps, horns, whistling; it’s all there. Seriously, just watch and smile.

Sometimes It Just Takes a Little Prodding

I used to run. There was a point in time at a previous job, where I wasn’t super happy, nor particularly engaged, and I could get out of the office at a normal time and go running. Distance running has never been my thing, but I would run 4–5 miles a day, 5 or 6 days a week.

Over the past few years, I’ve fallen into some bad habits. I’d go through phases where I’d run a few miles a couple of times a week; then it was running a few miles at the gym a couple of times a week. Until the last month, it was run every couple of weeks and pretend that the exercise I get from softball and basketball is enough to get by.

Periodically, I’d use something like Runkeeper to try to motivate me. “Hey, you should go running and try to do better than you did yesterday.” The downside—I’d often get frustrated because going from running 4–5 miles a day to 2–3 miles every couple of weeks was a big step back and seeing that displayed to me when I started the app was demoralizing, not encouraging.

I went through these cycles for a couple of years.

Then I got my new iPhone 5S with its M7 chip.

And, honestly, this isn’t any sort of amazing revelation, but just using an app like Pedometer++[1] is enough to help get me up and moving a bit more. It just measures your steps each day, and you can set a goal. It’s a Fitbit[2], but comes in a device that’s already in my pocket 90% of the day. It’s just enough prodding. I open the app, see I only have a few thousand steps, and I’ll go for a run (I went as far as to buy a thingy to carry my phone while I run). Or I’ll walk the long way to grab dinner.

It’s not much. But I’m sitting here on 9,300 steps for the day (which doesn’t count the hour and a half of basketball, or hour plus of softball – so I’m really probably closer to 20,000 steps), and I’ll probably go walk around a bit to get over 10,000 steps for the day.

It’s so incredibly stupid that I am motivated by a little number, and not by simply getting in better shape or generally being healthier.

But, it turns out, that seeing the little values go to 10,000 is just enough prodding.


  1. Grab it from the app store

     ↩

  2. I’ve avoided the Fitbit or Nike Fuel or any of those things forever, for a couple of reasons. One, I hate carrying things. I don’t wear jewelry or watches. I try to have as little in my pockets as possible. But, I think I should have joined the crowd and grabbed one of those things. I’d likely have figured out that I’m motivated by seeing round numbers a long time ago.

     ↩

A Couple of Quick Mavericks iCloud Keychain Gotchas

I’ve been using Mavericks for a couple of days now. I’m sure I’ll have more thoughts about it later (particularly about the multi-monitor support). But, right now, here’s a couple of gotchas that I found when using the new iCloud Keychain.

Turn on the ability to save passwords even when a website requests you not

Both on the desktop, in Safari, and in Mobile Safari on your iOS device, there’s a setting that controls whether or not you can autofill a password with your iCloud Keychain password. Since you probably want to control when you can autofill the password (not the website), you’ll want to override the default.

On the desktop, that’s in Safari’s Preferences, under Passwords. Down the bottom, there’s a little checkbox that says “Allow Autofill even for websites that request passwords not be saved”. Check that box.

Passwords

On your iOS device, go to Settings -> Safari -> Passwords & AutoFill, and turn on “Always Allow”.

Now you’ll never get that error message that you can’t use your saved password.

iCloud Keychain Doesn’t Save the Right Password if You Use PwdHash

I use a Safari Extension called PwdHash (that I actually created, built off of the open-source PwdHash extensions). PwdHash does a nice thing where it generates a new password for you on a site, based off of a password you know. That way, no matter what computer you’re on, or what browser you’re in (assuming you can find a PwdHash extension or bookmarklet), you can login to a site.

It’s pretty handy.

However, the way the Safari extension works (and this may be my fault), it picks up the password I typed in (my “master” password) and not the resulting hashed password after the extension runs.

…which means it ends up syncing the wrong password. That’s very possibly my fault, but could also be just a mechanism of how Safari/iCloud Keychain decides what to sync. It does mean that I need to be careful when saving passwords[1].


  1. However, as I go around creating new passwords, Safari’s new “suggested password” feature may make my need for the PwdHash extension moot.

     ↩

Typhoon at Brighton Music Hall (9/29)

It’s taken me a few weeks to sort out what I wanted to say about seeing Typhoon live for the first time. They put out my favorite song of 2011, and I think White Lighter is the current favorite to be my top album of the year, with three or four songs on it that I might like better than anything else I’ve heard this year. But, I’d never seen them live (which is somewhat rare for bands I really enjoy). They’d never really toured the East Coast.

Radiation City opened for them, and it was one of those great concert moments where you get exposed to a really good band that you’ve never heard of, and you begin to realize “Hey, this crowd is pretty cool right now. Into the music, not much talking, no one pushing to the front.”[1] I think most people who were there were as excited as I was to be there, and people were, sort of, on their best behavior.

IMG 2252

Radiation City played a really great set of synth-backed pop with lots of harmonies—right up my alley—but a bit slower than you might expect. Worth checking out on Spotify.

Then Typhoon came out. And from song one, they just owned it. Eleven band members, strings, horns, multiple drummers, and vocals and lyrics that just sort of wring emotions out of you.

IMG 2302

It was this big, cathartic release. A bunch of people waiting to see a band, the band coming out and being better than anyone probably expected, and the crowd just reacting with sheer joy. That joy was clear to the band, who acknowledged the crowd’s boisterous response more than once, giving the old “you’re the best crowd we’ve ever played in front of” spiel, but saying it like they meant it, which would just make the crowd react even more.

I know, I know. This all sounds ridiculous. But, sometimes you talk to people who really love Phish (or, if they’re a bit older, the Grateful Dead; it’s always a jam band), and they tell you about these shows where everything happened a certain way, and the lights were just right, and the crowd was just right, and the music segued just right.

That’s what this show felt like. Everything kind of all came together—a band firing on all cylinders, a crowd that had waited years to see the band—and it lead to a really, really wonderful show.


  1. Complete aside about concert crowds. They mostly suck. Obviously, it depends on the bands you see, but, if you’re seeing a band that attracts a college audience, it’s going to suck. College kids are college kids, and I now feel horribly old saying this, but they’re shitheads. I mean, we all were in college. But, when you go to a show for a band like Ra Ra Riot, you don’t expect to see bros jumping up on the stage and then stage diving. Or when seeing Clap Your Heads Say Yeah, you don’t expect to spend the entire show with a bunch of college hipsters pushing their way to the front to dance spastically because they “love the band.” We’re all there for the band, dipshit.

    Nada Surf attracts really great crowds that make the experience that much better. When I saw The Presidents of the USA recently, that was a great crowd full of people who loved the band. The crowd for Typhoon was one of best crowds I’ve experienced. Dancing and clapping for the right songs; getting quiet for the places that needed to be quiet.

     ↩

Freeing Up Space for iCloud Backups

Over the past few weeks, since upgrading to iOS 7, I’ve been getting error messages that the nightly iCloud backup hasn’t been able to finish because I don’t have enough free iCloud space. The odd bit about that is that I don’t remember seeing an error like that at all in the previous few weeks (or months, really). I’d occasionally seen the error due to connectivity issues, but never due to issues with storage space.

I let it linger for a few days, but knowing that my device wasn’t getting backed up bugged me enough to take a look.

Getting to the iCloud Backup settings isn’t entirely obvious.

Settings > iCloud > Storage & Backup > Manage Storage

That’ll drop you off on a screen that lists each of your devices that you are backing up. For me, it’s an iPad 2nd gen and iPhone 5S.

Drill into the device your on, and you’ll be greeted with a list of what is getting backed up on that device. You’ll see a list of apps, how much space the backup of that app takes, and an on/off switch to control whether or not you backup the data for that app.

Everything looked normal at first glance, until I noticed that Instapaper [1]

1.2GB of backup used for Instapaper. Double that, when you realize it’s installed on both my iPad and iPhone.

Half of my iCloud space taken up by one app.

Why is that a big deal? Well, Instapaper syncs all of its data with the Instapaper web site. So even if every article on my devices was deleted, I could just re-download them from the web. So there is literally zero need to back the articles up to iCloud[2]. CLick that button to off, and all of a sudden, all my backups are finishing with room to spare.

I’m guessing that some change in iOS 7 or a recent update to the Instapaper app changed what data it was backing up, leading to it filling up my iCloud storage. It’d be a nice thing for Instapaper or Apple (wherever the fault lies) to fix that in a future release. Regardless, if you find your device complaining about not being able to backup to iCloud, look for apps where the data can easily be recovered from the web (or another source). Wouldn’t you rather restore some web data to a single app than have to piece together all of the settings and apps on your phone because you weren’t backing it up?


  1. Instapaper is a “read later” app, where you can save articles you find online to read later (handy when you’re killing time in a line, or maybe in that other place where you do your reading.

     ↩

  2. And, honestly, why the hell is it backing up 1GB of data? It’s all text and maybe some images.

     ↩

Hokie Football, circa 2013

As I mentioned in my previous post, I took a trip to Blacksburg to see my Hokies play. I hadn’t been to Lane Stadium in 5 or 6 years, and I had never sat on the alumni side.

Setting aside the quality of play, the absolutely drenching rain, and the fact that I missed seeing “Enter Sandman”, it was a pretty awesome trip. I snapped a few pictures from our seats using my new iPhone (the 5s).

IMG 2227

The Drillfield on a rainy, rainy day

IMG 2231

IMG 2232

Lane Stadium, from the West Stands