I’ve written a simple nagios check for TFL’s services (Tube & DLR): check_tfl.tar
Latest version in my github repository.
If you’re a python programmer, you probably know all about the troubles mixing tabs and spaces can cause. I have searched far and wide, and have collected some really useful configurations for setting up the perfect Emacs configuration for Python.
What it does:
Insert spaces instead of tabs when indenting
Sets indent to 4 spaces when in python mode & SGML (superset of HTML) mode. This is useful for the web developers out there.
Highlight tabs and trailing whitespace (thanks to http://www.emacswiki.org/emacs/highlight-chars.el)
Hexspeak, like leetspeak, is a novelty form of variant English spelling using the hexadecimal numbers. Created by programmers who wanted a magic number, hexspeak words can serve as a clear and unique identifier with which to mark memory or data.
Put the below in your ~/.emacs:
;; make thinkpad browser keys navigate buffers
(setq w32-pass-multimedia-buttons-to-system nil)
(global-set-key (kbd "<browser-forward>") 'next-buffer)
(global-set-key (kbd "<browser-back>") 'previous-buffer)
(global-set-key [C-XF86Forward] 'next-multiframe-window)
(global-set-key [C-XF86Back] 'previous-multiframe-window)
On my x220 this allows the browser forward & back keys (above right & left cursor keys) to be used to switch buffer and combined with ctrl to switch frame / window.
M-x vem, or define your own keybinding.
;; short function to load ~/.emacs
(defun vem ()
Here is a simple apache config file reformatter I’ve knocked up: apachelint.
To use, just apachelint [conffile] > newconffile
It will clean up indentation and empty lines.
If you are using emacs to edit Python with auto-complete enabled, you really should install smart-tab to intelligently toggle between indentation and completion.
Now, in 2014 Perl is considered rather embarrassing – but it is still widely used. I’ve wandered off the Perl path towards the seductive embrace of Python myself.
However, in some environments you cannot choose your toolset. I’m a big fan of Ansible and it has gone on from strength to strength with VC and a commercial operation behind it, but there are alternatives.
Rex is a similar tool to Ansible, but written in Perl. I’ve used it for a few basic tasks and here are some of its features:
Low Entry Requirements
On the “master” server side you need Perl 5.8.8 or greater (ie – the version that comes with Red Hat / Centos 5) and a small number of additional modules. On the client “target” side all you need is Perl.
For communication from master to target, it just uses ssh, like Ansible. No installing new daemons or opening up new firewall rules.
Works well with existing environments
As well as using existing ssh infrastructure, Rex can use ssh certificates (with or without ssh-agent) or username/password. It can enter your ssh private key passphrase or password for you. It can also use sudo on the remote box and enter the password for that too.
As Rex recipes are written in enhanced Perl, you can easily use other features of the language or other modules in your scripting.
Rex supports running tasks in parallel – you select how many threads you want running simultaneously.
Update: I asked in IRC whether it was possible to split groups for staging pushes – the author of Rex answered.
A tiny piece of SQL to update email addresses in a table where the domain is changing:
update aliases set emailaddr = concat(SUBSTRING_INDEX(emailaddr, '@', 1),
'@newdomain.com') where emailaddr like '%@olddomain.com';
Very simple, but this has been hanging around in draft for ages and it may help someone.