Wednesday, November 2

some things i have been using lately

git-annex: I don’t yet have my head around more than a fraction of what git-annex and the git-annex assistant do. That said, the short version is that it lets you track files (usually large files like photos, but really anything) in a git repository without storing their actual contents in the repo’s history. It does this by leveraging symbolic links to blobs of data in the .git directory, and pushing data around between your local copy of the repo and various kinds of remote storage: Other repositories accessed over SSH, filesystem locations, Amazon S3, and so on.

I’ve been using these features on p1k3 to store images and thumbnails for simple galleries. (Here are some notes about my use case from back in August — the short version is I want to publish pictures without having to trust third parties like flickr, imgur, or Instagram.) The workflow is still a little bit confusing, and git-annex itself is enough of a hack that there are bugs to work out. Still, this feels like one of those fundamental changes to a paradigm that becomes, over time, an obvious necessity.

I backed one of Joey Hess’s crowdfunding campaigns for this project a while ago. It’s good to see work like this get real traction, and I plan to keep chipping in for its development.

Debian/Ubuntu installation: apt-get install git-annex

moreutils: Another joeyh joint, this one has been around for a while. It bundles a set of tools that fill gaps in the classic set of Unix utilities.

The thing I’ve used most often here is sponge(1), which collects standard input and writes it to a desired file. That doesn’t seem like much, but it lets you do something like this:

somecommand somefile | sponge somefile

A reasonable replacement for this idiom:

somecommand somefile > somefile

…which sooner or later everyone discovers doesn’t do what they’d expect, because redirecting to a file opens the file for writing before it executes somecommand somefile.

Debian/Ubuntu installation: apt-get install moreutils

fzf: I’ve been using dmenu to launch programs, jump between windows, and navigate directories for quite a while now. dmenu takes lines of standard input and lets the user select one (narrowing the selection with type-to-search), then prints it to standard out. It’s a simple idea, but elegant and fast for a good many tasks.

fzf is essentially the same idea, but runs in a terminal and offers more tunable search modes along with optional prefab keybindings in the shell. It can replace, for example, Bash or zsh’s standard Ctrl-R for searching in history. There are also shims for integration with tmux and Vim, and the author has taken an admirably modular and unixy approach to all of this.

I’m not completely comfortable with the interface of this one yet, but it’s a general purpose utility I’ve wanted for a while, and can easily imagine building other tools around. I’ll probably integrate it with commandlog for searching and annotating history.

Installation: Some ad hoc hackery explained in the repo. Here’s hoping it winds up widely packaged before long.

ranger: A column-based file manager with vi-style navigation. Python, but so far hasn’t been terrible and crashy, so it’s doing something right. Feels in the spirit of LIST, a piece of software I still miss constantly.

Debian installation: apt-get install ranger