Grid corrections

Sometimes when riding gravel races (which mostly follow roads laid out on the Jeffersonian grid), I would come to a T intersection. I never really thought about why this happens, but Gerco de Ruijter has turned it into an art project:

By superimposing a rectangular grid on the earth surface, a grid built from exact square miles, the spherical deviations have to be fixed. After all, the grid has only two dimensions.

The north-south boundaries in the grid are on the lines of longitude, which converge to the north. The roads that follow these boundaries must dogleg every twenty-four miles to counter the diminishing distances: Grid Corrections.

Grid Corrections (a one minute) from Gerco de Ruijter on Vimeo.

— January 1, 2017

How to accept gifts for a Vanguard 529

We recently set up a 529 account to save for our daughter's college education. You can accept gifts from grandparents and others with a 529, but it's surprisingly difficult to find out how this works. It took me a while to figure out; hopefully writing this down will save someone out there some time.

To accept gifts for a Vanguard 529, you need to link the account to Ugift.

To do this with Vanguard, log in and click "Go to my 529 plan account area". This launches a new window for 529 account management.

Vanguard go to 529 account management

Next, click on "Ugift" in the side bar and fill out the form to generate your Ugift code.

Vanguard UGift integration

Once you do, you'll see instructions about how to share the code and can also download a PDF for relatives who prefer to contribute offline.

Once you have the code, you can provide it to benefactors to input at Ugift

UGift input code

Upon entering the code, they'll see the beneficiary's name, so they'll know they're contributing to the right kid.

UGift gift form

Hope this helps you. And Nia's code is really V6G-V7J as shown above, in case you feel like helping out.

— December 21, 2016

Fixing "Permission denied (publickey)" when connecting to a Travis CI build container

I was attempting to debug a build with Travis CI's SSH connection option (sadly, I can't find any documentation about this feature -- it's the "Debug job" button).

After the Debug job starts up, it prints:

Use the following SSH command to access the interactive debugging environment: ssh <random-string>

But when I tried this, I got:

Permission denied (publickey).

It took me a while to figure out why this was happening. What public key should a temporary SSH connection use? After talking to my co-workers, who reported no problems connecting, I remembered I had set up a separate public key for GitHub. By specifying that key with -i I was able to connect:

ssh -i ~/.ssh/id_github_rsa <random-string>

— December 13, 2016

What San Francisco Says About America

Thomas Fuller returns to the US after nearly 30 years abroad, mostly in developing countries. He is shocked by the in-your-face poverty of San Francisco.

Of course some of what I’ve encountered has been less alluring. During all my years in Asia I constantly grappled with the perniciousness of poverty. Yet somehow I was unprepared for the scale and severity of homelessness in San Francisco.

The juxtaposition of the silent whir of sleek Tesla electric vehicles, with the outbursts of the mentally ill on the sidewalks. Destitution clashing with high technology. Well-dressed tourists sharing the pavement with vaguely human forms inside cardboard boxes.

One possible reason for this is the lack of continuity in rich countries. There are fewer gaps to fill, so a person is either in the system, or completely outside it.

During a trip back to Bangkok I spoke about this paradox with Nopphan Phromsri, the secretary general of the Human Settlement Foundation, an organization that assists the homeless there.

Greater Bangkok, a sprawling metropolis with more than 10 million people, has 1,300 homeless people, a survey this year found.

San Francisco has less than one-tenth Bangkok’s population but six times as many homeless people. I’m sure you could fill a book with the reasons for this. Ms. Nopphan believes that homelessness is more intractable in rich societies. “In wealthy countries there are systems for everything,” she said. “You’re either in the system or out of the system.” There is no in-between in America. In Bangkok, by contrast, rich and poor coexist. There are vast tracts of cheap, makeshift homes and a countryside where people in the cities can return to if they lose their jobs or hit hard times.

— September 19, 2016

The American tropics

The New York Times provides a visualization of the steady Northern march of extreme heat due to global warming. By 2060, much of the country will experience 20+ days a year above 100º F.

By the end of the century, that will expand to include almost the entire country except for Northern coastal areas, the West coast and the high Rockies.

It's easy to see this as a map of where not to live. It must also be a call to action. Unfortunately, it feels like we are slipping past the point of no return. The feedback cycles are already in motion. Even with massive cuts in carbon emissions, radical geoengineering may be our only option to preserve the climate our species has prospered in for the last 50,000 years.

— August 23, 2016

Adding a command to list recently changed git branches (three ways)

I wanted to add a command to make it easy for me to see what branches I'd worked on recently. Between different projects, bugfixes, and code reviews, I end up switching branches a lot, and it can be hard to remember the names of the branches I need to polish up for submitting as a pull request and merging. It's also useful to find branches that can be deleted.

This is a git command to show all the branches sorted by date descending (branch names may be changed to protect the innocent):

git for-each-ref --sort -committerdate refs/heads/

1b46ebacca9d6a4f49698b59577e21254471f6ac commit refs/heads/look/fp-email-on-first-completion
875686cd2b9db4fe45b24a96299f71933f6599fa commit refs/heads/master
9ef1d512fcc6e05dc5b80121e1e3768c011bb167 commit refs/heads/look/document-position-metadata
ed6df9b73e2c38d74ee3419c71ee488703c8cb27 commit refs/heads/look/fix-dp-500
7b130aceaeafe31077265b6a1b7cdabd1f8329d4 commit refs/heads/look/improve-document-position-caching
fcb726b5372255a3b1c50eac1c04cf5eda4587d4 commit refs/heads/look/remove-rails-4-caching-hacks
bd1f3df97cfd3dcbe9803770fd24944bed01f236 commit refs/heads/look/remove-rails-3-code
9b6bc693e5273cf3a7ddea1062462ae333c1bb6a commit refs/heads/look/fix-selenium-rails-4
c231b29f083b14d7cdb698e8f4d2be105bc32e45 commit refs/heads/look/fix-account-router
8d16a3868f8a12961ee8dbcaa383fae7a10ebcd8 commit refs/heads/look/handle-invalid-content-hash
fe50ecee84e6017dfa444bb426c4ac7c9929fa50 commit refs/heads/look/unknown-format-rails-4
3bfe056947a351151d0e3cf18a61f30e9e03209b commit refs/heads/look/pluck
e903be6d8f2a2a170d913b5e77801600ec49023d commit refs/heads/look/match-array
bb07270a5045c737f60530ca1d3b8b17e2cdf7bb commit refs/heads/look/fix-change-column
bca2a817b32395576fe2c10be53b02022689ba75 commit refs/heads/look/rails-4-fixes
70c6e053c89e066f1eed0038faa1834ca255b4d4 commit refs/heads/look/GET_LOCK-sucks
07176fb95a802a3ca5dfcce5d3757d9831ef7d52 commit refs/heads/look/refactor-query-execution
5cb599fc57c7729ea8ed76f62ccd930b774a4d9c commit refs/heads/engine_index_refactor
(... dozens of branches omitted ...)

Adding a bit of formatting makes and piping to head makes the output easier to read:

git for-each-ref --format='%(committerdate:iso8601) %(committerdate:relative) %(refname)' --sort -committerdate refs/heads/ | head -15    

2016-08-04 17:59:50 -0700 4 days ago refs/heads/look/fp-email-on-first-completion
2016-08-04 17:24:34 -0700 4 days ago refs/heads/master
2016-08-04 15:02:23 -0700 4 days ago refs/heads/look/document-position-metadata
2016-08-02 13:27:42 -0700 6 days ago refs/heads/look/fix-dp-500
2016-07-28 12:24:30 -0700 11 days ago refs/heads/look/improve-document-position-caching
2016-07-19 19:55:07 -0700 3 weeks ago refs/heads/look/remove-rails-4-caching-hacks
2016-07-19 18:45:06 -0700 3 weeks ago refs/heads/look/remove-rails-3-code
2016-07-19 18:07:56 -0700 3 weeks ago refs/heads/look/fix-selenium-rails-4
2016-07-19 15:03:15 -0700 3 weeks ago refs/heads/look/fix-account-router
2016-07-18 17:36:24 -0700 3 weeks ago refs/heads/look/handle-invalid-content-hash
2016-06-30 18:49:33 -0700 6 weeks ago refs/heads/look/unknown-format-rails-4
2016-06-29 19:18:17 -0700 6 weeks ago refs/heads/look/pluck
2016-06-29 19:17:18 -0700 6 weeks ago refs/heads/look/match-array
2016-06-29 11:17:49 -0700 6 weeks ago refs/heads/look/fix-change-column
2016-06-21 14:36:50 -0700 7 weeks ago refs/heads/look/rails-4-fixes

This is a lot of typing, though! The easiest way to shorten it is to create a Bash alias:

alias grecent="git for-each-ref --format='%(committerdate:iso8601) %(committerdate:relative) %(refname)' --sort -committerdate refs/heads/ | head -15"

However, I wanted to make this a new subcommand, because I have trouble remembering to use Bash aliases.

The first thing I looked into was using a Bash function:

function git() {
    if [[ $@ == 'recent' ]]; then
        command git for-each-ref --format='%(committerdate:iso8601) %(committerdate:relative) %(refname)' --sort -committerdate refs/heads/ | head -15
        command git "$@"

This intercepts invocation of the git command. If the argument is recent, it runs my command. Otherwise, it passes the arguments to the git command (the Bash command builtin is used so it can call the real git). One thing I learned writing this is that getting the quoting right is super important.

That's not the only way to do it, though!

You can also add a git alias. Since this version doesn't take an argument, that's fairly simple:

        recent = !git for-each-ref --format='%(committerdate:iso8601) %(committerdate:relative) %(refname)' --sort -committerdate refs/heads/ | head -15

Because I only want to show some of the recent items, I need to invoke the alias as a shell command using ! so I can use head. You can also add arguments to git aliases, but it is a bit more complicated.

Another way is to add a new executable named git-recent to your $PATH (Antonio Santos Velasco has a good tutorial about this.). This will enable you to type git recent to invoke it. I have a ~/bin directory that is on my path, so that is a pretty easy place to stash such a command. If you want to add argument parsing (for example, to change the default number of recent items), using a stand-alone script is probably the easiest way.

Here's the full git-recent script:



git for-each-ref --format='%(committerdate:iso8601) %(committerdate:relative) %(refname)' --sort -committerdate refs/heads/ | head -$ITEMS

You can invoke it like this to get the default number of recent branches:

git recent

Or specify the number of branches:

git recent 10

Now that I have an easy way of listing recently changed branches, I use it constantly. It's been super useful for me. Maybe it will be for you, too.

— August 15, 2016

Fighting the future

Growing government budget deficits of around the globe have resulted in no small part from insistent demands from top earners for tax cuts. Some have advocated such cuts as part of a "starve the beast strategy," in which depriving the government of revenue would supposedly help eliminate government waste. But government programs exist because important constituents want them and are therefore extremely difficult to cut. Cuts, when they do come, typically occur not where they would make the most sense, but where those who would suffer from them are least able to push back. An important result of deficits has thus been to reduce our investment in the future. The unborn citizens who will suffer as a result are simply unable to protest.

-- Robert H. Frank, Success and Luck

This is a simple explanation for many of the United States' problems, from disinvestment in infrastructure which squanders the inheritance that we received from our predecessors to closing off our most productive cities to new residents through restrictive housing policy. It's easy to fight the future, because future citizens can't vote.

— August 14, 2016

Ignoring files in git without cluttering up history

If you are like me, you have a couple scratch files lying around in your repository. They don't have anything to do with the project and aren't relevant to the other members of my team, so I don't want to add them to .gitignore.

The usual outcome of this is selectively committing and trying to avoid checking in these extraneous files. However, I recently learned that there is a git configuration file called .git/info/exclude you can modify to ignore files. It's like .gitignore, but not checked in.

Here's an example:

# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

This is mentioned in the gitignore documentation and with more context by GitHub.

— August 6, 2016

How “Silicon Valley” Nails Silicon Valley

If Washington, D.C. is Hollywood for ugly people then Silicon Valley must be Hollywood for nerds. This article shows how desperate many of those nerds are to be part of a cultural moment, and how frustrated they can be when their Valley-famous bubble is burst by actual fame.

“Some Valley big shots have no idea how to react to the show,” [T. J.] Miller told me. “They can’t decide whether to be offended or flattered. And they’re mystified by the fact that actors have a kind of celebrity that they will never have—there’s no rhyme or reason to it, but that’s the way it is, and it kills them.” Miller met Musk at the after-party in Redwood City. “I think he was thrown by the fact that I wasn’t being sycophantic—which I couldn’t be, because I didn’t realize who he was at the time. He said, ‘I have some advice for your show,’ and I went, ‘No thanks, we don’t need any advice,’ which threw him even more. And then, while we’re talking, some woman comes up and says ‘Can I have a picture?’ and he starts to pose—it was kinda sad, honestly—and instead she hands the camera to him and starts to pose with me. It was, like, Sorry, dude, I know you’re a big deal—and, in his case, he actually is a big deal—but I’m the guy from ‘Yogi Bear 3-D,’ and apparently that’s who she wants a picture with.”

— July 16, 2016

Take it from me: Your local library needs a cat

Yes, yes it does.

— July 14, 2016