Batch convert images to sepia tone with python

Posted by Mike on Jan 13th, 2010

The Python Imaging Library (PIL) offers easy photo manipulation from python scripts. There’s some handy sample code on effbot.org that demonstrates how to alter an image’s palette to generate a sepia tone effect. It first desaturates the image, then applies a new palette based on a linear ramp.
I’ve cleanup up that sample code [...]


VIM Tip of the Day: leave python comments indented, don’t put cursor at beginning of the line

Posted by Mike on May 15th, 2009

If you’re ever been annoyed by VIM throwing your cursor to the left margin when you type “#” in a python file, there’s a simple remedy. It’s the fault of “smartindent” in VIM, which in reality isn’t all that smart. If you want to leave smartindent on but fix the weird hash behavior, [...]


Notes from PyCon 2009

Posted by Mike on Mar 29th, 2009

Just wrapping up a fantastic few days at PyCon Chicago 2009. I went with a group of about 10 guys from AGI, and we managed to have a little bit of fun in between some great mind-enriching talks.
Here are some notes I jotted down while at the conference. It’s a bit overwhelming, but [...]


Java is a Bad Ex

Posted by Mike on Feb 17th, 2009

Although I’ve been enamored with Python for the last 13 or so months, I’ve often dreamt longingly for days of Java glory. Things from the past seem so desirable at times — IDEs with good code completion and integrated debugging, staticly-typed compiler hand-holding, mature application servers and deployment tools. There was never much [...]


PyCon 2009

Posted by Mike on Feb 15th, 2009

I’m going to PyCon 2009! I’ll be there with a few other guys from work. We’re flying in Wednesday night, taking a tutorial on Thursday, and trying to have a little fun throughout the weekend.


Including external data with your unit tests

Posted by Mike on Jan 13th, 2009

We generally preach that you should not use real data in your unit tests. You should instead mock said data out in an effort to lesson potential side-effects, including degrading test performance and adversely affecting live data.
Sometimes, you’d like to test actual file handling in a unit test. If you do, you should [...]


Python multiline regex

Posted by Mike on Jan 13th, 2009

After pulling most of my hair out, I realized a simple mistake in my Python regular expression usage. I had been trying to search a simple HTML document for some text, which happened to be broken across a newline such as:

<div>I’m some
[...]


Tamper-proof python dictionary

Posted by Mike on Sep 22nd, 2008

Sometimes the need arises to pass a python list, tuple, dictionary, etc. from one page to another. If you do not have a session service to hold it, the object may need to pass through a HTTP request (in cookie or get/post param), opening the possibility of tampering. Without some precautions, a serious [...]


Checking for pythondoc comments with pylint

Posted by Mike on Sep 22nd, 2008

When using automated code-style checkers, such as pylint, we often want to check that our documentation meets certain standards in addition to the code itself. If you want to stray from PEP8 and use PythonDoc aka pydoc instead of the traditional docstring-style comments, you might struggle for a moment to find something to [...]


On my mind today

Posted by Mike on Sep 17th, 2008

I’ve got some ideas that I need to find time to work on. In no particular order:

Port MockMe to the Dojo javascript framework
Utilize browser history sniffing to build a generalized user segmentation framework
Write a Ubiquity plugin for spreeder (to easily speed read a page in Firefox)
Port OWASP’s AntiSamy project to Python, to provide comprehensive [...]


Next »