occasional posts about programming, tech, and the dreaded etcetera

Use Rsync Instead of Cp

I tend to use rsync when others would typically use a simple cp for copying files. A few reasons:

  1. It can be canceled in the middle, and resumed later.
  2. It can show a progress bar that (while not perfect) is great for large files or lots of files.
  3. It will only copy the changed files and won’t clobber already existing directories of files at the target.

rsync is available on Linux, Mac, and there’s a binary somewhere on teh intarwebs for Windows.

To use, you almost always want to pass the -a flag, which stands for “archive” – basically a convenience flag for -r (recursive), -p (permissions), -t (timestamps), and a few others. I can’t think of a time I haven’t used -a when using rsync.

Following that, basic usage looks like this:

rsync -a source destination

The other thing to remember when using rsync is that it’s picky with slashes; if you put a trailing lash on a path, then rsync takes that to mean you want to copy the contents of that path. If, on the other hand, you leave off the slash, it will copy the path and its contents. A few examples will help:

# This will copy the stuff directory (and its contents) to the documents directory
rsync -a /home/tim/stuff /home/tim/documents

# This will copy only the contents of stuff to the documents directory
rsync -a /home/tim/stuff/ home/tim/documents

Some other handy arguments:

  • --stats
  • --progress

So, to put it all together:

rsync -a --stats --progress /home/tim/stuff /home/tim/documents

And, better yet, rsync can work over ssh (if it’s installed on both hosts). Just put an ssh host on the front of either path:

rsync -a --stats --progress /home/tim/stuff


rsync -a --stats --progress /home/tim/

So, there you have it. rsync can do tons more stuff, but this is a great start. If this is all you learn of rsync, you will be that much better off.

MBP Upgrade

My 1st generation Macbook Pro is starting to show its age, but tonight I used my birthday money in an effort at rejuvenation.

First, a new Seagate hard drive. 500gb, 7200rpm, $99 at Best Buy. It took about an hour to get my machine apart, with all its tiny screws, get the new drive in, and put it back together.

Next, I said good-bye to Mac OS X. I installed the brand new Ubuntu 10.04 LTS, and man it screams on this machine. I’m not sure if it’s Linux, the new drive, or a combination. This machine has new life!

Some pictures of the operation are below:

Whiteboard Icons


Back in 2005, I uploaded a bunch of crude little pictures to my Flickr account and called them my “Whiteboard Icons” set. Hundreds of people have, over the years, found them to be useful on their blogs, flowcharts, and more.

Today, I finally added a couple new icons to the set (1, 2). Only took me five years.


Update: Various sizes and scalable versions are available in the whiteboard_icons git repository.

Csv2wufoo is a little side project I wrote using Sinatra, my WufooParty lib, and James Edward Gray's FasterCSV lib.

After the tenth time my wife asked me to write a one-off script to import data into her Wufoo form, I decided to generalize it a bit, slap a Sinatra app around it, and give it a domain name (well, there was a little more to it than that, but ya know…)

It hasn't quite been battle tested yet, but hopefully it will be useful to someone.

We love Wufoo at our church and use it almost daily for all sorts of things. Gathering submissions is only one small trick in its bag of 'em – Wufoo's reporting makes it a really good platform for visualizing flattened data, among other things. Staff in our church use Wufoo in ways they should probably be using Excel, but Wufoo makes it so much easier.

With csv2wufoo, we should now have a better way of getting data into the system.


I wanted to understand the Facebook REST API better, and decided I needed a simple wrapper for it. HTTParty to the rescue again!

FacebookParty (rdoc) is along the same lines as my other _party style api wrappers. I can't take much credit for it though, since HTTParty is what makes this stuff so easy. Slap a pretty class on an api endpoint, and the rest is cake. And cake goes good with parties.


Flickr API for Ruby Using HTTParty

Continuing with my HTTParty, I’ve created a fairly simple Flickr API wrapper for Ruby: flickr_party. This one was a bit more difficult than the Campaign Monitor one, but still fun nonetheless.

Why reinvent the wheel?

  1. It’s fun.
  2. I always learn something.
    • Sometimes I learn to not reinvent the wheel.
    • But sometimes I learn so much more.
  3. The libraries out there I spent 10 minutes looking at didn’t seem to fully support application authentication. Yes, I’m sure I’m wrong, and they all support it just fine. Or maybe I was just looking at the wrong ones. But in any event, I took this as the opportunity to build something cool (see item #1 above).

CascadingRubies - Ruby DSL for Generating CSS

I’ve been working on a little experiment lately… a Ruby domain-specific language for generating Cascading Style Sheets called CascadingRubies.It’s an internal DSL, meaning it uses plain Ruby syntax, like this:
Being just Ruby, of course, you can mix in variables, arithmetic, require external code, hit the database, or whatever.The guys on the Tulsa.rb mailing list have provided some great feedback, and from that I’ve released the the second gem version (0.2.0). If this looks interesting to you, head over to the GitHub project and check it out. Please let me know what you think.