Some site fiddles
Abstract
Two small tweaks to the site: fresh kerning for the swashes on the
front page, and the move to git
on my local machine
Table of Contents
1. Swish swash font
I have been consistently niggled by the poor kerning of the font I
initially used on the front-page, and inspection of the outlines shows it
was of very poor quality indeed. Some Googling turned up the font (Caslon
Initials) on various sites, posted by various users and mostly described
as ‘public domain’. This makes me suspicious, but I went ahead and found
the best-quality version I could and rat over it with
fontforge
, correcting its errors and tweaking its metrics.
You can grab it if you are really interested from the page, but I will
eventually dump the glyphs into a swash table in the Latin Modern
font.
All in all, a tiny fix to just the sort of error that irks me.
2. Using git
to sync to a server without git
installed
I did have the development version of this site on the SRCF over the summer, while my main machine was sitting disconnected in my room. Now I have transferred the site back to my own desktop, I needed a better way of syncing it the distant server. An aggravating battle ensued as all the options seemed not to work ideally.
The first attempt was to upload the site over FTP. That is slow and unreliable (I gave up after uncovering bugs with Unicode filenames over SFTP in various popular scripts). SFTP is just not very reliable.
The next idea was to set up something with cgi-bin
to
add some git
to the server, but there was too much black
magic.
The really cunning idea was thinking of efficient ways to use
sshfs
. You install it (in all distros), mount the remote
server like any normal removable drive, and modify the files like a local
filesystem, totally seamlessly. At this point, the lack of
git
on the server is irrelevant, as the local copy of
git
just does all the work.
So, what work do we set it? There are various things I tried,
unfortunately starting with the least efficient. I tried making a
repository on the server and pushing to it, but reading and writing to the
.git
folder over SSH is a mistake. The
obvious optimization is to copy the .git
folder to my machine
and symlink it into the right place; after all, it is only the working
copy I want to have on the other end. That is easy, and much quicker. How
to get the push to work though is still not obvious. I tried pushing to an
unchecked-out branch, and merging through a post-receive hook, but the
merge is slow as the mtimes of the entire working directory need to
fetched from the remote server so the local git
can do its
merge. Next, we try running a checkout, but it simply re-uploads the
entire working directory. Not as slow, but it takes many minutes. The same
result holds when doing a hard reset. I tried a few more things, with all
the clever options I could think of, but the approach is fundamentally
broken as git
will basically always traverse the entire
working directory when doing something on it.
In the end, the answer is embarrassingly simple. I cooked up a
bash
one-liner, expanded it a little, and produce here my own
perfectly adequate solution. Selecting a particular branch to diff from
and push to would be a trivial addition.
Example 1. /home/nicholas/bin/site-update
if [ ! -e /home/www/mounts/nicholaswilson.me.uk/XIV ] then sshfs -oworkaround=rename <user@shared hosting IP>:public_html/nicholaswilson.me.uk \ -p <port> /home/www/mounts/nicholaswilson.me.uk/ fi cd /home/www/XIV git diff --no-prefix `cat /home/www/mounts/nicholaswilson.me.uk/XIV/REVISION` HEAD \ | patch -p0 -d /home/www/mounts/nicholaswilson.me.uk/XIV/ cp .git/refs/heads/master \ /home/www/mounts/nicholaswilson.me.uk/XIV/REVISION
So, patch
does all the fiddly stuff for me that
FTP scripts have to mess around with, and the output is
highly satisfactory. It is a bit of a pity that this method did not turn
up on any of my Googling.
3. More fun!
As always, this gives me a couple of little tweaks to make when I next have a spare half hour to format any notes. The hottest things on my list are now styling the file listing above to use a modal pop-up; I will re-use it to display image thumbnail expansions too.
I will also rationalise my feeds in an easier-to-use format so that I can add more links to Reader without feeling guilty about spamming.