Tuesday, March 28

wednesday, march 15

you've got to remember
that a lot of your mind,
a lot of the systems that your mind
integrates with
live outside of your body as you conventionally
think of it
outside of the skin and bones, beyond
the fur and feathers, external to the
narrow motions and faculties of an isolated animal

you're on the bus, riding up the highway through
the grass and utility polls, past the houses
and herds and irrigation ditches
you're looking out the windows of a conveyance
borne on taxes and legislation and road projects
and the history of a whole place

you've got the wind in your hair and a watch on
your wrist telling time according to a system
with its roots centuries deep, date math grounded
somewhere in systems ancient now for millenia

you're writing on a device impossible
to build a decade back
in strings of glyphs with their roots in
phonecia, in rome

the birds are coming back and making nests
the grass and leaves are breaking out into the sun
you feel good when you step outside and breathe the air
the air is a product of a system well beyond your
understanding and control

and yet also a system that includes you and enfolds
your actions, encompasses whatever meaning your life
might have, travels through the circuits flickering
inside your head, your heart, your lungs and legs
and fingers walking on the keys

Saturday, March 11

git-do: execute commands in the top level of a git repo

tl;dr: Use git config --global alias.exec '!exec '. Or for some reason you could write a script like this one to execute commands in the root of a git repository.

This blog lives in a git repository with entries broken up by date. So, for example, when editing this entry, I might be in a path like so:


I also have a Makefile in the top level of the repo, which contains targets like render and publish. Since make expects to find a Makefile in the current working directory, I often found myself in a loop where I edit a blog entry, change to the top level of a repo, run a make command, and then need to change the blog entry again.

This seems silly, and generalizes to a bunch of different repositories.

Stack Overflow says that you can do git rev-parse --show-toplevel to get the root directory of the repository, which led me to something like:

$ git config --global alias.root "rev-parse --show-toplevel"
$ cd `git root` && make render && cd -

That works, but it’s a stupid amount of typing. There are a couple of solutions for this. One, from that SO post, is:

$ git config --global alias.exec '!exec '
$ git exec make render

This works because the leading ! on the command tells git to treat it as a shell command, and by default git executes aliases to shell commands from the top-level directory of the repo. This is probably good enough, but I didn’t notice it at first so I added a git subcommand called git-do to do pretty much the same. A very simple version looks like this:


git_root=`git rev-parse --show-toplevel`
cd "$git_root"

A slightly more “sophisticated” one uses git-sh-setup, which provides some boilerplate for shell scripts written as git subcommands:

#!/usr/bin/env bash

# Help messages:
LONG_USAGE="Executes <command> from the root of the repository."

# Tell git-sh-setup we're ok with being in a subdir:

source "$(git --exec-path)/git-sh-setup"

# Make sure we're in a working tree, jump to top level, do command:

In both cases, $@ is a variable containing all of the arguments to the script, which run as shell commands.