Setting up colourised svn diffs

This is mundane, but something I will no doubt forget, and so for my own posterity:

The svn diff is monochrome by default. Let’s install colordiff and change that.

sudo apt-get install colordiff
vi ~/.subversion/config

In the [helpers] section set the diff command to /usr/bin/colordiff

To ensure that when you do svn diff | less the control characters for the colours are rendered correctly you’ll need to set the default options for less:

Edit ~/.bash_profile and add

export LESS=R

Then run source ~/.bash_profile. Done!

Configuring the VS Code integrated terminal to use Bash instead of cmd.exe on Windows

Visual Studio has an integrated terminal and by default on Windows this loads cmd.exe – the standard, and fairly rubbish Windows command prompt.

I normally use cmder as my default terminal on Windows –
this is basically the excellent conemu tabbed console emulator, with a few customisations.

If you try and set VS Code’s integrated terminal to the cmder executable, it will open a new terminal window, rather than be integrated, so you need to point it at the bash.exe executable instead.

After installing cmder to to C:\cmder the bash binary is in C:\cmder\vendor\git-for-windows\bin and the setting you need to add to VS Code is this:

"terminal.integrated.shell.windows": "C:\\cmder\\vendor\\git-for-windows\\bin\\bash.exe"

This will now give you bash when you open the integrated terminal! On one of my computers the default prompt came out ugly, so I changed it like this:

Open the integrated terminal and type

vi ~/.bashrc

Then enter insert mode by pressing ‘i’ and pasting in this:

export PS1="\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[35m\]$MSYSTEM\[\e[0m\] \[\e[33m\]\w\[\e[0m\]\n\$ "

Save the file by pressing Escape, then typing ‘wq’ and pressing Enter.

Exit the terminal by typing ‘exit’ (rather than just hiding it by using the VS Code menu or keyboard shortcut.

Re-open it and tada! a much improved integrated terminal!

Sending files to Ubuntu Intrepid over bluetooth

Out of the box you cannot send files over bluetooth to a computer running the latest stable version of Ubuntu, Intrepid Ibex, 8.10.

This is a bit of a problem for me since my main camera is my trusty Nokia N95. What you can do is send files to your phone, and browse its filesystem, just not receive. As you can imagine, there are some open bugs about this. The seemingly recommended solution of installing gnome-obex-server also installs apache2 and sendmail, which seems like a bit of overkill to me.

Enter Blueman. Just add these lines to your repositories config (you can follow these instructions)

deb http://ppa.launchpad.net/blueman/ppa/ubuntu intrepid main
deb-src http://ppa.launchpad.net/blueman/ppa/ubuntu intrepid main

and then sudo apt-get install blueman.

A quick click on System -> Preferences -> Bluetooth manager (it took a few minutes for the icon cache to update for me) and you have the new manager for your bluetooth devices. You don’t need to do anything special to be able to send files to Ubuntu now, just click “send” on your phone and you’ll be asked if you want to accept the file being sent. By default the files will be saved into your home directory. There’s more information on the site and in the forums. Have fun, kids!

Twitter on Ubuntu – use Gwibber

Screenshot of Gwibber
Screenshot of Gwibber

Gwibber is a native desktop Twitter client for Ubuntu. It will post updates to and receive updates from Twitter as well as a host of other services like Flickr, Facebook, Digg, can update your Pidgin status and pull in any other RSS or Atom feed you like.

It will sit in your notification area waiting until you get some messages which it will display as pop-ups in the corner of your screen, and won’t steal focus whilst it does so (take that, twitterfox!).

It is unobtrusive, attractive and easy to use. Theme templates are just HTML and CSS. I recommend giving it a go.

In Jaunty Jackalope it is in the Universe repositories (so sudo apt-get install gwibber will work) but for everyone else you can either follow the instructions on this page (which means you will get future updates) or go direct to the Gwibber PPA page, expand the section with your distro listed and grab the .deb file.

Setting up Trac on Debian Etch with Apache 1.3 (a brief guide)

This is a summary of what I got from the Trac installation instructions here, here, here and here. My life would have been easier if I was running Apache2, but for the site in question, I’m not.

The version numbers I am working with:

  • apache – 1.3.34-4.1
  • python – 2.4.4-2
  • libapache-mod-python 2:2.7.11-2
  • Trac 0.11b2

Install easy_install, followed by the Trac requirements:

$ easy_install Pygments
$ easy_install Genshi
$ easy_install Trac
$ easy_install sqlite
$ apt-get install libapache-mod-python
$ apt-get install python-pysqlite2
$ cd ~
$ mkdir trac/myprojectname
$ trac-admin trac/myprojectname initenv

(enter the details you need or just keep hitting to accept the defaults – it’s all configurable later)

Type the tracd line given to you at the end of the install and make sure it runs (probably need your IP at this point because it won’t bind to a hostname).

Add this inside your VirtualHost:

<Location /wherever/you/like>
  SetHandler python-program
  PythonHandler trac.web.modpython_frontend
  PythonOption TracEnv /absolute/path/trac/myprojectname
  PythonOption TracUriRoot /wherever/you/like
  PythonDebug On
</Location>

Patch /usr/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/web/modpython_frontend.py with code from http://trac.edgewall.org/wiki/TracModPython2.7 (yes, it’s all needed) – the “Known Issues” at the end of the code apply, most notably “There may be a character set issue” – for me this manifested itself in the <title> element of the page with a “–” separating my project name from the word “Trac” rather than a long hypen.

The point of distraction

It turns out that I hate having the mouse cursor visible in my working window. I didn’t really know about this until I used a colleague’s dual-monitor machine. He has set the window focus to follow the pointer and I consistently selected the window I wanted to type in and one whoosh of the mouse later was happily typing code into Firefox.

It turns out that this doesn’t really work 🙂

After I went back to my machine I tried to pay attention to what I was doing with the mouse after I’ve selected a window, and I do indeed almost always give it a quick flick left or right and take the pointer to the edge of the screen where it’s out of my way.

So it means I’m glad to find out about unclutter (via Erik), a small Linux application for hiding the mouse pointer after a customised period of delay. Much nicer!