OpenSSH ControlMaster and Subversion

OpenSSH has a fantastic feature called ControlMaster. Basically this option allows you to create a socket that will share your already opened ssh session to the same host. To enable this option for all you put the following snippet in your $HOME/.ssh/config after creating something like $HOME/.ssh/sockets:

Host *
  ControlMaster auto
  ControlPath ~/.ssh/sockets/%r@%h:%p

For every username@host:port it will create a socket in $HOME/.ssh/sockets. The only problem is that current Subversion (1.4.6 on my FreeBSD box) cannot work well with control sockets when using the svn+ssh:// URI identifier. In order to work around this problem you can add a specific host before the wildcard entry, for example:

Host svn.example.com
  ControlMaster no

Host *
  ControlMaster auto
  ControlPath ~/.ssh/sockets/%r@%h:%p

Of course, doing it like this is a bit tedious for every Subversion repository you use in this manner. Thankfully there is another way to do this. In $HOME/.subversion/config there is a section called [tunnels]. If you add the following entry to that section it will disable the ControlMaster:

[tunnels]
ssh = ssh -o ControlMaster=no

Consolas font and the Windows command prompt

Now that Microsoft allows you to download the Consolas font the question becomes how to add it to the list of choices for the command prompt properties.

In the Microsoft Knowledge Base article 247815 you can find instructions on how to add a font.

Basically on most default Windows XP installations it boils down to adding a String name '00' to the HKLMSoftwareMicrosoftWindows NTCurrentVersionConsoleTrueTypeFont with a value of 'Consolas' (the corresponding name from HKLMSoftwareMicrosoftWindows NTCurrentVersionFonts).

screen, 256 colours and termcap mixed with PuTTY and FreeBSD

I have a 256 colour xterm set up on my DragonFly box.

Works perfectly. Especially for vim.

Now, I use FreeBSD 5.x as a gateway box to ssh into and have irssi and likewise programs screened.

Now, I was surprised to learn that I had only 16 colours. Outside of screen I had a full 256 colour palette (make sure to fix your PuTTY configuration by the way), but inside I was stripped of my colour scheme.

So I set off to find what was causing this. Interestingly enough one of the first emails encountered was from Jeremy Chadwick who had the exact same problem.

Turns out that screen needs to be compiled with 256 colour support (a knob should be in your ports Makefile now).

Since FreeBSD's and DragonFly's termcap is bereft of any 256 colour definitions for xterm apparently, you need to add the following to $HOME/.screenrc:

termcap xterm* 'Co#256:AB=E[48;5;%dm:AF=E[38;5;%dm'
terminfo xterm* 'Co#256:AB=E[48;5;%p1%dm:AF=E[38;5;%p1%dm'

This overrides your termcap settings with the appropriate definitions.

If you now start screen from a shell that has TERM exported as xterm or xterm-color (xterm* wildcard actually) it will fork off to a screen with 256 colour support.

You might need this in $HOME/.vimrc:

if &term =~ "xterm" || &term =~ "screen"
  set t_Co=256
  if has("terminfo")
    let &t_Sf=nr2char(27).'[3%p1%dm'
    let &t_Sb=nr2char(27).'[4%p1%dm'
  else
    let &t_Sf=nr2char(27).'[3%dm'
    let &t_Sb=nr2char(27).'[4%dm'
  endif
endif

True Type fonts, X.org, and MathML

I use MathML. Why? Because it just makes sense for mathematics on the websites.

On my DragonFly I had to do the following:

Installed X.org 6.8.1 or .2. Enable xfs (the X font server) by adding xfs_enable="YES" to rc.conf.

From ports install x11-fonts/ttmkfdir and x11-fonts/urwfonts-ttf.

(Note: download doesn't exist anymore.)

New and better instructions: https://developer.mozilla.org/en-US/docs/Mozilla/MathML_Project/Fonts

In /usr/X11R6/lib/X11/fonts/TTF do:

# ttmkfdir > fonts.scale
# mkfontdir

This will update fonts.scale and fonts.dir, check them with cat or more to see if they contain references to the extracted new .ttf files.

Change /usr/X11R6/lib/X11/fs/config to have /usr/X11R6/lib/X11/fonts/urwfonts-ttf added to catalogue.

Also add /usr/X11R6/lib/X11/fonts/urwfonts-ttf as a FontPath to /etc/X11/xorg.conf:

# xset fp+ /usr/X11R6/lib/X11/fonts/urwfonts-ttf
# xset fp rehash

Edited $HOME/.fonts.conf and added:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="pattern">
    <test name="family">
      <string>symbol</string>
    </test>
    <edit name="family" mode="append" binding="strong">
      <string>Standard Symbols L</string>
    </edit>
  </match>
</fontconfig>

Added user_pref("font.mathfont-family", "Math1, Math2, Math4"); to $HOME/.mozilla/firefox/<profile.default>/user.js.

There seem to be some bugs still, at least in displaying the W3C test suite.