Git + Dropbox, The Easy Way

There seems to be a lot of differing opinions out there on how best to handle git + dropbox.

My solution, is to keep it simple. Store git bundles in dropbox.

Further, I’ve added a hook for post-commit to dump the bundle right into dropbox. This way, I a) force myself to commit more because I can’t lazily rely on dropbox syncing all saved files and b) assure that my files–nay, the whole repository!–is backed up into the cloud.

My .git/hooks/post-commit file looks like this:

#!/bin/sh
cd ~/Documents/Code/BeerProject
git bundle create ~/Dropbox/GitBundles/BeerProject.git.bundle master

And that’s what I call, The Easy Way.

Marcus Aurelius’ Meditations, Book 8, #36

Emphasis mine:

Do not disturb yourself by picturing your life as a whole; do not assemble in your mind the many and varied troubles which have come to you in the past and will come again in the future, but ask yourself with regard to every present difficulty: ‘What is there in this that is unbearable and beyond endurance?’ You would be ashamed to confess it! And then remind yourself that it is not the future or what has passed that afflicts you, but always the present, and the power of this is much diminished if you take it in isolation and call your mind to task if it thinks that it cannot stand up to it when taken on its own.

Hacking the Cloud, with dropbox alternative Copy

I’ve recently gotten inspired to start actively taking photos again, mostly due to a friend of mine getting heavily into photography. As such, I felt it was time to finally solve my backup issues, namely that I didn’t have any. In fact, I’ve “lost” our family photos at least twice, and was able to recover them using hard drive recovery tools–but that is far from a disaster recovery plan!

First things first, I decided to commit myself to Aperture. I’ve dabbled in it once or twice since getting my macbook, but never really committed to it.

Having acquired Aperture, I needed a backup solution. “The Cloud” was the obvious answer (for me), but I’ve had little success with Google Drive in the past (the Mac app kept crashing on me), and found Dropbox’s prices to be more than I’d like to pay. Onwards to Google (searching)!

I found this.

Reading through the article, I was familiar with three of the four alternatives. Copy was new to me, so I investigated it further. The initial 15+5GB was a good place to start for me, so I signed up.

Having selected a new provider, I started to wonder if I could extend the referral plan using lifehacker’s tops for dropbox. So I looked around for Google Adwords credit. Not finding any, I went back to the drawing board.

Reading Hacker News, I wondered if Copy had been mentioned there. So I googled it, and I could find a recent reference. Thus, I posted this:

Copy – a dropbox alternative that starts at 15GB + unlimited 5gb referrals (that was the original title, or something like it, but the moderators edited down to just “Copy”. I assume due to their terms of service, even though many articles violate that).

Within hours I started getting 5GB referrals, and it lasted into the next day. I now sit a comfortable 290GB (I’m hoping for those last 2 signups to get to 300GB) and my cloud needs will be met with Copy for the foreseeable future.

In fact, I’ve already uploaded 13GB of my 40GB Aperture library, and it hasn’t crashed yet, which is a great sign compared to Google Drive!

In [2013], the Matrix [Still] Has [Me]

In 1999, the Matrix Has You
Tagline from the original movie trailer hosted on apple.com.

I find it very depressing that my children will never fully appreciate the Matrix for the amazing futuristic movie that it was is.

Even by re-watching the trailer, it still seems set in the far off future, it seems like cinematic sci-fi that’s fresh and tantalizing, the way the music of the Doors, despite being from the 70s, still astoundingly has a nouveau vibe to it. The Matrix has me, but I’ll never be able to impress on the next generation why it’s so amazing.

The depth of the story–probably largely evading me to this day–evidenced by the singluarly focused book comparing The Matrix with The Bible, even drawing inferences from the use of swearing in the movie: when the curse words Jesus Christ are used, they’re only used in reference to Neo, the protagonist of the film(s). (I’m unable to find a link to the book, unfortunately, but I digress, I’m talking about material that’s 1.3 decades old).

About a year ago I was sitting in my office lunch room and around the table were a number of teenagers (we hire the children of our employees for summer employment to help them pay for college). I was curious, so I asked the table: “what’s the best movie you’ve seen?” The overarching response was: Batman: The Dark Knight. OK, fair enough, it’s a great movie, so I followed up the question more poignantly: “what do you think of The Matrix?” The response in that case was: it was a good movie… for it’s time. For it’s time?! The Matrix is beyond the realm of time! (Well, except maybe for the gaudy Nokia phone–which I always wanted to own).

While I have difficulty with this, I have witnessed it from the other side. My father-in-law, with as much excitement as I’m sure I’ll convey to my children when they’re of-age to see The Matrix, sat me down to show me The Big Chill. It didn’t do anything for me then (I was in my early 20s at the time), although I might appreciate it more now. It was clear that my blasé response to the film was disappointing to him, much as I’m sure I’ll be disappointed when I finally show the then-nearly-three-decades-old Matrix to my daughters.

In the words of the title of the poem, I guess its: The Way of All Flesh.

How disappointing.

PHP vs. Python for RESTful Web API

… or maybe that should be the Slim Framework vs. ?? (something in python) for RESTful Web API.

My major concern regarding the backend framework selection is how cool parameterized queries work. PHP looks pretty straight forward, and using MySQLi seems to be the best practice, but there’s just something that seems dated with them.

For Python, however, I was able to find this code:

some_dictionary_with_the_data = {
    'name': 'awesome song',
    'artist': 'some band',
    etc...
}

cursor.execute ("""
    INSERT INTO Songs (SongName, SongArtist, SongAlbum, SongGenre,
        SongLength, SongLocation)
    VALUES
    (%(name)s, %(artist)s, %(album)s, %(genre)s, %(length)s,
        %(location)s)
    """, some_dictionary_with_the_data)

Neat! Build a small array of variables, and pass that array to the string, nice!

In looking at RESTful Web APIs for python, I’ve momentarily given up. For now I’m going to get going on PHP with the Slim Framework, and if I need to change later, it shouldn’t be too painful.

Revenge of the Cascadian IPA

Tonight was bottling night–or more succinctly, adventures in bottling night.

First, I don’t like the hop bits that get left over from dry hopping, so I was looking for a way to filter them. My Tazo Awake tea comes in cotton tea bags, so I cut one open, soaked it and an elastic in sanitizer and stuck it on the end of my auto siphon. It started OK, but seemed to introduce a lot of air, and ended up getting clogged, plus, the air bubbles make me worry of oxidation. So I pulled it out, took off the tea bag and elastic and resumed siphoning.

Immediately after, I notice my bottling bucket is leaking! What the homebrew!

I quickly rinse my hands and forearms down in sanitizer and plunge into the fresh beer to tighten up the spigot. It’s a stop gap, but at least the leak has slowed to a drip.

After that, things went according to plan and experience. I enjoy filling bottles and capping them, so that was fun.

The beer smells amazing, and I’m eager for it to carbonate. It might even be ready for next week’s London Homebrewers Guild meeting.

Learning AngularJS

I’ve been looking to build a new website, which pending a name I’ll just call the Beer Project. In considering how to build it, I wanted something really simple, preferably something I’ve had a bit of experience with.

The first option was web2py. I really like the ideology of the platform, and spent a couple weekends trying to get it running on my webhosting provider. Having failed at that, I setup a nice system with port forwarding, etc., that I could code with at home, figuring if it ever went live I could just host with Amazon’s AWS or Google’s App Engine. When I sat down to start digging into some web2py code, I kept running into the “where to begin” mental roadblock.

After considering it further, the annoyance of web2py not running on my webhosting provider became too much, so I decided to flip over to CakePHP. I quickly setup CakePHP on my provider, added the debugging modules, etc. that it recommends, and felt I was off to a good start, so I focused on database design for awhile.

Then, I did something stupid. I was reading Hacker News one day, and decided it was time to figure out what all the fuss was regarding Backbone, Ember, CanJS and Angular.

WOW. Client-side MVC! I’ve been a huge fan of jquery for the past three years, and this concept sounded better. After reading about them, I tried to determine which was popular, and which looked like it’d be something I could invest in. CanJS seemed the most promising at the start, but the example code didn’t seem for me. Backbone and Ember sounded too low-level for me, which left me with Angular. Apparently it’s done by Google (actually, founded by a Google employee and another guy, now continually maintained by the same Google employee and a couple other googlers).

So I start reading over the docs, and I just end up feeling stupid. Over a decade of code experience, and I just can’t get my head wrapped around it. Enter today. I see this article:

Diving into AngularJS

His second paragraph struck a real nerve with me:

Initially I downloaded the Angular source and launched into trying to build something simple with it but I found this a really frustrating experience. I consider myself a pretty competent JS developer but nothing really worked and the concepts didn’t click. Making me feel stupid is a quick way to turn me off of something.

After watching the same tutorial he watched, coupled with the Wine Cellar angular app–which uses the Slim Framework to provide REST web services, I’m now pretty damn excited to kickstart the Beer Project.