One simple way to back up files is to copy them to Dropbox. However, manually copying files does not constitute a good backup, you’re going to forget.

Also, you want to be smart about it and just copy things that have changed or are new. My favorite tool for smart copies is rsync.

If you aren’t familiar with rsync, it’s a program for intelligently syncing one directory tree with another. It looks for additions, changes, and, optionally, deletions in a source directory (and it’s subdirectories) and make the destination an exact copy. After an initial copy is created, rsync is very efficient as further syncs only copy changes.

In my last post about an alias that opened a URL from the command line, I said:

open is OS X specific. On Linux you’d want xdg-open or gnome-open, on Windows, start, under Cygwin, cygstart.

A friend of mine reminded me that I forgotten a simple option for Ruby developers, his cross platform solution, Launchy.

If you’re ever sitting in a Git repository in the shell and want to view it on Github, here’s some quick laziness.


alias view-on-gitub=$'open `git config --get remote.origin.url | awk -F: \'{ print ""$2}\'`'

(The $ after the = is an example of using Bash’s ANSI C quoting mechanism.)


alias view-on-gitub 'open `git config --get remote.origin.url | awk -F: ' \' '{ print ""$2}' \' '`'

(CSH single quote escaping is even more convoluted…)

Basically, we grab the remote URL from with git config, strip out the repo path and slap in front of it with awk, and then use open to feed the new URL the default web browser.

This makes a couple presumptions:

  • You are in a Git repo.
  • You are using SSH style URLs.
  • open is OS X specific. On Linux you’d want xdg-open or gnome-open, on Windows, start, under Cygwin, cygstart.

Making it smarter is left as an exercise to the reader.

I wrote and maintain (though not as attentively as I’d like) a Ruby Gem, Strongbox, which adds Public-key Encryption support to Rails’ ActiveRecord. Simply put, Public-key Encryption is a form of encryption with two password, one to encrypt data and another to decrypt it. This is handy for web applications, any visitor can encrypt data using encryption password (the public key). However, if an attacker gains access to the server and steals the data and the app’s code, they still can’t decrypt the data because they lack the decrypt password (the private key).

The problem is you’re doing it wrong.

When I need to test web apps on an iPhone or iPad, I use the iOS Simulator that ships with Xcode1. The Simulator is intended for developers testing native apps, however, Mobile Safari is installed and I can use it to debug apps without a physical device. I’m lazy and don’t want to open up Xcode just to get to the Simulator. Fortunately, it’s a standalone app that lives in /Applications/ That’s way too much to type, aliases to the rescue.

A visitor, Rakkesh, stopped by with a question about Building Emacs 24.4 From Source on the Mac. He had an issue that when he built Emacs on one machine (a Mac-Mini Server) the resulting application would not run on another (his laptop). He wrote:

Is there anyway I can create a self contained bundle which can be redistributed on all my machines without installing any additional dependencies, such as, gnutls, libxml2 - the latest versions from Homebrew, on those machines?

The problem occurs because Emacs’ build process will greedily take advantage of any libraries it can find installed on the build system. If you’ve installed something the build considers useful like gnutls or libxml2, it will link against them. However, results in an executable that always loads those libraries and won’t run on systems that don’t also have them installed.

Making up passwords is hard. You want something you can remember which is and you need something difficult to guess or brute force.

For countless years, I have been a fan of Diceware for generating memorable passwords, really pass-phrases, and you should be too.

I have lots of shell aliases/functions for repetitive tasks. Copying files to and from servers, removing editor backup files, connecting to specific databases, the list goes on.

Sometimes however the thing I want to do is directory specific. A good example of this is when I’m developing scripts. Typically, I edit in the comfort of my desktop, and copy scripts to the server for testing. As I’m often working on multiple files, I use rsync to keep the remote directory in sync.

# Edit
rsync -av .
# Test

This keeps the local and remote directories in sync, uploading only the files that have changed. There are other work-flows I could use, for example, my editor supports remote editing with SSH, but rsync works for me.

HTML5 <audio> tags is pretty straight forward. Given:

<audio id="player"></audio>

this bit of Javascript:

player = document.getElementById('player');
player.src = 'some-audio-file-url';

will start playing whatever the src points to. (Pro-tip: If you are using jQuery, you need get the actual HTML element with player = $('#player')[0] or player = $('#player').get(0))

However, if the user is on either an iOS or Android mobile device, the above won’t actually play anything.

Previously, I showed how I set $EDITOR. On my laptop, I actually do something different to take advantage of my favorite Emacs feature EmacsClient. EmacsClient is command line accessory that commands existing Emacs sessions to open files. That way you can have Emacs open with your windows arranged the way you like and push in files that you want to work as you go.

In addition, EmacsClient can be used as $EDITOR to cause programs, say a ‘git commit’ to open a window instead of starting a new editor session.