walls.corpus

By Nathan L. Walls

Habitat 67/Montréal

Habitat 67/Montréal

I’ve finally started editing photos from our June trip to Montréal. The photo above is along waterfront, south of the old port, looking across a quay to Habitat 67, a housing complex built as part of Expo 67.

Our friend and host for the week, Igor, showed us around different parts of the city our second night in town, and we drove by Habitat 67. It was rather striking.

Later in the week, photo walking the Pointe du Moulin site, we were given a hint to walk around Silo No. 5 by a couple of guys walking a dog and, through a bit of a fence, and we’re at the end of the pier Silo No. 5 sits on and Habitat 67 is right across the water. In a nice coincidence after we got back from Montréal, Stars announced The North the album cover for which features Habitat 67. It’s well worth a listen.

I have a small, but growing, set of Montréal photos over on Flickr. Check it out.

Git cloning and branch heads

Last week at work, I was trying to diagnose apparent trouble with a Git repository. Whenever the infrequently updated repository was cloned, we would end up in a different branch than our devel branch. Not knowing if there was a problem in the remote bare repository, I dug around refs/heads and HEAD on both the remote repository and in a fresh local clone. Not seeing any apparent trouble, I Googled.

I came across the following mailing list post that explained my trouble:

… the git protocol does not expose which branch HEAD points to, only which commit. So if two branches point to the same commit, git just takes the first branch and points the local HEAD to that.

How we ended up in that situation is like this:

  • Starting with an existing repository, create a branch off of master or whatever other branch you treat as your default HEAD
    • NB: We use devel as a historical artifact
  • Publish the new branch to the remote origin
  • Clone the repository somewhere else and examine the new clone. There’s a good chance the new repo will be using the new branch instead of master

I created a GitHub repository to demonstrate (although there’s no guarantee you’ll get the new branch on clone).

1
2
3
4
5
6
7
$ git clone https://github.com/base10/branch-head-examples

(add files)

$ git push
$ git branch feature
$ git push -u origin feature

Now, I’m going to look at a fresh clone:

1
2
3
$ git clone git://github.com/base10/branch-head-examples.git clone-example
$ ls clone-example/.git/refs/heads
master

So, I didn’t get feature. If however, in your clone, you saw this …

1
2
$ ls clone-example/.git/refs/heads
feature

… you would just need to do this:

1
2
3
4
$ cd clone-example
$ git checkout master
Branch feature set up to track remote branch master from origin.
Switched to a new branch 'master'

Now, diff the refs/heads files:

1
2
$ diff .git/refs/heads/master .git/refs/heads/feature
$

Getting an unexpected branch from a repository in this state isn’t harmful. It is a little disconcerting if you’re looking at a repository you established, but don’t work with frequently. I suspect this case is more likely to come up under the following circumstances:

  • You don’t have a master branch at all (which might be true if you’ve converted a Subversion repository) or master is a dead branch
  • You have a mainline of development and create a release branch from the mainline of development
  • The repository, with all branches, is pushed
  • The repository is later cloned, with no further changes.

Saving Safari URLs with AppleScript and Ruby

I occasionally have a metric mumbleton of browser windows and tabs open, particularly if I’m digging into a research topic. In the past, if I’ve needed to close out windows or tabs, but have wanted to keep the context, I’ve gone to each tab individually and saved the URL to a file.

In the last week, I found myself with about five windows and 45 tabs, so my typical approach strikes me as insufficiently lazy. So, I was going to find or write something to handle the task for me. My initial Google research didn’t turn up the sort of AppleScripts I fully expected to exist. So, it looked like I was going to be writing AppleScript myself.

I found some code in a similar area and I reached my typical wall with AppleScript. At some point, I should actually solve a problem with AppleScript, but instead, I used the rb-appscript gem and wrote a Ruby script that interacted with the Safari AppleScript dictionary, based on a concept I saw in a StackOverflow post.

Here it is:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env ruby

require 'appscript'
require 'yaml'

include Appscript

safari    = app 'Safari'
url_list  = safari.windows.tabs.URL.get

url_list.flatten!

dt          = DateTime.now
date_format = dt.strftime("%F_%H%M")
list_path   = "#{ENV['HOME']}/saved_urls_#{date_format}.yml"

File.open(list_path, "w") do |f|
  f.puts(url_list.to_yaml)
end

This is also available as a syntax-highlighted GitHub Gist.

It’s nothing magic, but just the sort of simple utility that solves a small problem for me.

Running with fabulists

From the August 6 New Yorker, Mark Singer covers an improbable marathon runner:

…The Missoula course, which is mostly flat, passes through rangeland and forest, crosses two rivers, and in its final miles offers a tour of the city’s tree-lined neighborhoods. Early in the race, [Kyle] Strode broke ahead of his usual rivals, and never saw them again. The second masters runner to cross the finish line, Mike Telling, from Dillon, Montana, trailed Strode by nearly four minutes. At the awards ceremony, however, they learned that Telling had actually placed third. The official runner-up was Kip Litton, age forty-eight, of Clarkston, Michigan. Litton, who had been at the back of the pack when the race started, began his run two minutes after the gun was fired. He had apparently made up for lost time.

What’s great is how Singer’s reporting – online and in person – help develop the story. He also has eyes and ears for detail:

As Lady Gaga’s “Poker Face” played on the Wendy’s stereo system, he elaborated: he had never deliberately done anything wrong, never left a race course and reëntered at a different point, never received money through Worldrecordrun, and never posted anything on LetsRun; had no idea who the anonymous people might be who posted in his defense, and no clue who might have posed as a nurse claiming that “Dr. Litton’s child has been given just a short time to live.”

This was seriously fascinating.

Mushrooms of Durant

Ramariopsis kunzei/Raleigh

Robin and I visited Raleigh’s Durant Nature Park yesterday, taking the Border Trail through the woods. With all of the recent rains and cooling weather, much of the forest floor was liberally sprinkled with several varieties of mushroom.

I’m not a mycolophile, just a general appreciator of nature, and it was amazing to see quite different mushrooms than what shows up on our neighbor’s front lawn or in our back yard.

While researching what I took pictures of, I stumbled across a site that helps people with mushroom identification. Search the page for “Id #43”, and you’ll see the scariest and stupidest thing I’ve read in some while:

Those look like mushrooms I found on horse manure in central California. They had purple-black or black spores. I ate one and if gave me pain right below my throat for a few days. It felt like there was a stone in my chest.

Knowing that some mushrooms are deadly poisonous, I’m surprised anyone would eat any mushroom not from the grocery store without being damn sure what they were eating. Me, I’ll probably just be appreciating the visual beauty of these fungi.