Tag Archives: Work

Figuring out largest/smallest/median filesizes

I had to get some statistics about file sizes today, but couldn’t really find a tool for the job, so naturally, I wrote one. import os, sys, re from os.path import join, getsize, exists   def median(numbers): s = sorted(numbers) … Continue reading

Posted in Uncategorized | Tagged , | Leave a comment

Keeping ssh connections alive

I’ve got nothing more to say than: mads@workmads ~ % cat .ssh/config ServerAliveInterval 60 Happy ssh’ing.

Posted in Uncategorized | Tagged , , | 1 Comment

Python http_head method

Seeing as there is no really easy way to do a HTTP HEAD request from python, I wrote up the following small method: In advance I’d like to apologize for the method that assemblies the request path. Update: Added handling … Continue reading

Posted in Uncategorized | Tagged , , , | Leave a comment

Formatting xml with xmllint

I keep forgetting how to format and indent xml from the command line. The tool xmllint does a fine job of doing just that, which has saved me numerous times whilst working with sports results. So. Much. Data. Running xmllint … Continue reading

Posted in Uncategorized | Tagged , | Leave a comment

Very simple email sending method in python

I needed to send an email, so I came up with this:   def send_plain_mail(subject, body, from_mail, to): import smtplib from email.MIMEText import MIMEText from email.Encoders import encode_quopri   msg = MIMEText(body, ‘plain’, ‘iso-8859-1′)   msg[’Subject’] = subject msg[’From’] = … Continue reading

Posted in Uncategorized | Tagged , , , | Leave a comment

Using mercurial with eclipse to edit actionscript files on os x

We have recently switched to use mercurial as our DVCS. We’re hosting our many repositories on bitbucket. I love it. When it comes to actionscript files, flash has always had odd newlines. For some reason, it has always used \r … Continue reading

Posted in Actionscript, Programming, Work | Tagged , | 1 Comment