Archives
Blogroll
Python
Tag Archives: Python
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
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
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
Fun with mod_macro and django
At work we yestoday decided to update our internal url structure for our client test sites, issue management systems and such arround a bit. Seeing as we decided on purchasing a genuine signed ssl wildcard certificate, we needed to change … Continue reading
Posted in Apache, Django, Python, Work
Tagged Apache, coniuro aps, Django, mod_macro, Python
Leave a comment
Asynchronous socket server in python
The code for a very simple asynchronous socket server written in python utilizing the asynchat module. It’s all in good fun.