“Invert” a dict in python

If you have a list/tuple in python and you want to use the items in there to return an index of the position of the item, you can do so like this:

a = ('archive', 'audio', 'document', 'video', 'executable',
'image', 'misc', 'parity')
lookup = { v:k for k,v in enumerate(a) }

Warn your clients before disabling SSLv3 on Apache for POODLE

With POODLE, everyone is hurrying to disable SSLv3 on their webservers. However some sites still have clients that for whatever reason have not updated from XP / IE6 (it’s only been out 13 years, what’s the rush?) Instead of immediately locking them out you might like to give them a few days warning with some Apache 2.2 config as below:

Set the RewriteRule to an explanatory page of your choosing (if it’s on the same HTTPS server, you’ll need to exclude the page to prevent a rewrite loop).

If you don’t have IE6 to hand, you can test this as below:

Hitting a link in an HTML email in mutt

add

macro attach V |'lynx -stdin'\n

to .muttrc

then when you are in the attachment menu, select the HTML content and hit V. This will launch a lynx process to view the content, follow links, etc. This is on top of having text/html ; lynx -dump -force_html %s ; copiousoutput or similar set in your ~/.mailcap to view inline.