Disabling hyphen substitution in Adium

By default Adium replaces two hyphens with an em-dash in text you type or paste. This leads to subtly confusing behaviour when pasting commands:

foo --bar

becomes “foo —bar”, which can look very similar to foo --bar if your contact is using a terminal that supports variable-width glyphs for exotic character points.

It’s a quick fix: stop double-hyphens being transformed to a long dash by right clicking the Adium input field, and unticking Substitutions > Smart Dashes from the menu.

window titles in screen and rxvt, from zsh

Recently I’ve been multiplexing work over many urxvt terminals: essential when you’re monitoring the logging output of several related binaries and managing several git branches related to each. The sensibilities of awesome have eased the window management, but I’ve become increasingly reliant on the window title to identify particular sessions. This is compounded one level further when I’m using screen; I want a useful identifier to show up in screen’s windowlist.

Getting nice prompts is a common need and there is plenty of information out there on setting your PS1, but for various reasons I’ve had problems finding a ‘nice’ setup that’s just worked exactly the way I’ve wanted it to with titles. Here are the pertinent parts of my working configuration:

  • I get the working directory and current command in the title
  • I get the title in the screen windowlist if running in screen
  • I get the same title in the WM_NAME of an rxvt or xterm, or the titlebar of an iTerm2, whether or not screen is involved

Continue reading “window titles in screen and rxvt, from zsh”

RFC 6225 Geolocation configuration generator tool

While mobile devices (especially those with a GPS) have made people more aware of geolocation/geotagging, you don’t need a GPS in a device to make it location-aware, nor do you need to resort to IP-based reverse lookups. Location information can be made available on any network that has a DHCP server using the Location Configuration Information DHCP Option defined in RFC 3825 and RFC 6225. It makes sense: for most wired or wireless networks, the engineer responsible for setting up the DHCP server will know at the least where the server or AP is located, and maybe even static information about the locations of each terminal of a wired port.

The Option has a somewhat unorthodox binary format with non-power-of-2-width fixed point reals. To make generating the DHCP configuration statements easier, I developed a web-based RFC 6225 location configuration generation tool. It’s all client-side and even has a Google Maps preview of the location!

Copy the configuration to your local DHCP server, grab an appropriate geolocation library, and you’re ready to go! The tool generates a DHCP LCI Option for both dnsmasq and ISC’s dhcpd.

The lack of fixed point integers in Javascript made the implementation a little trickier than it would have been in, say, C.

Other lessons: Google Maps is not highly accurate.

Update 2019-06-01: updated the tool from RFC 3825 to support RFC 6225 and the GeoLoc option.

Search engine optimization with git web interfaces

I recently became frustrated with gitweb’s funky query-strings and decided to give cgit a try. Although there are some patches that make gitweb more user (and search engine) friendly, cgit is a much better web-interface for git, both in terms of the code and the actual user experience. However, there were still some opportunities for SEO.

I went through the HTML suggestions from the google webmaster tools and Google’s own SEO Starter Guide. I’ve pushed the search engine optimized cgit to my seo branch on github. You can see it in action at my git repositories. I’m testing all of this using an Apache ScriptAlias directive, I’m hoping it will still work alright with whatever other URL-processing schemes cgit supports. A short summary of the new SEO features so far:

  • Use HTML h1 and h2 heading tags instead of custom-styled divs
  • Much better title tags; commits have the commit subject, and the repo name has been added in a lot of places to avoid duplicate titles
  • The bread-crumb has been integrated into the heading
  • A configurable option to set nofollow relationships on links to non-HEAD commits, to avoid duplicate content being indexed

Of course, you could take the popular option of just using github instead of self-hosting your own git web interfaces… but even they don’t do quite a good a job IMO, they use the SHA1 in the web page titles, eww!