Author Archives: Kamil Kisiel

Quickly open the source of a Python module from the command-line

Add this to your .bashrc: pysource() { $EDITOR $(python -c "import ${1}; import inspect; print inspect.getsourcefile(${1})") } Your favorite editor should pop up and you can browse the module source. If you want to open a module from an existing … Continue reading

Posted in Programming | Tagged , | View Comments

Trac Math Plugins Galore!

I’ve decided to put my Trac plugin hackery knowledge to use. This past week I became the official maintainer of the TracMathPlugin. This is a plugin we use on our Trac installation at work which lets people enter in Math … Continue reading

Posted in Programming, Python | Tagged , , | View Comments

GridEngine TotD: Making an advance reservation for resources which aren’t currently available

So you’re trying to set up an advance reservation for someone, something fairly simple such as: qrsub -u bob -N openmpi_test -pe openmpi 8 -l h_vmem=1G -d 500:0:0 However, due to the cluster being busy you get the error: error: … Continue reading

Posted in HPC | Tagged , | View Comments

New OOM killer implementation in Linux 2.6.36

As reported on Kernel Newbies, there is almost a complete rewrite of the Out Of Memory (OOM) killer algorithm in the recently-release 2.6.36 kernel. The LWN article “Another OOM killer rewrite” has a detailed explanation of the changes. The addition … Continue reading

Posted in HPC, Linux, Sysadmin | Tagged , | View Comments

Speeding up SQLAlchemy collections with innerjoin

Recently I’ve been working on a project wherein we rewrote a body of code whose architecture was… well, less than ideal. We took a mess of an object model and built something more elegant and structured. The new code design … Continue reading

Posted in Python | Tagged | View Comments

Eclipse, Python, and file extensions

So I’ve recently been giving Eclipse (and PyDev) a try for developing Python. Despite my initial hesitation of switching away from Vim, I’ve found it to be quite productive. My text editing speed is not nearly as good as in … Continue reading

Posted in Programming, Python | Tagged | View Comments

Making the alt key work in X11 on OS X

It seems something is broken about the default keyboard map in X11 on OS X. I discovered this while trying to use an X-forwarded version of Eclipse from our cluster and couldn’t get any of the shortcuts that use the … Continue reading

Posted in Desktop | Tagged , | View Comments

Easy context managers with contextlib

Do you ever use some functions in Python that you wish had a context manager, but do not? Are you too lazy to write one? Then use the contextlib module! I often need to work with gzipped files, but unfortunately … Continue reading

Posted in Programming, Python | Tagged | View Comments

Quickly check SSL certificate expiry from the command line

A quick little snippet to check when an SSL certificate on a remote server is expiring: openssl s_client -connect mail.example.com:25 | openssl x509 -noout -enddate Works for any kind of SSL service, not just SMTP.

Posted in Sysadmin | Tagged | View Comments

OpenVPN + OpenLDAP

Jordan’s posted a comprehensive setup guide for OpenVPN with OpenLDAP on his blog. Looks like OpenVPN is a great way to set up a simple client VPN solution, and the cost is certainly a lot lower than solutions from Cisco. … Continue reading

Posted in Sysadmin | Tagged , | View Comments