Coding: Bring the Noise

%26lt;0011 Em

Archive for the ‘Uncategorized’ Category

PyProMan: virtualenv wrapper for multi-project development

leave a comment »

Developing with SublimeText continues to be a pleasure, except that curious interaction with virtualenv and ST’s build system.  I seem to have two choices:

  1. Create a new build system for each virtualenv – which is pretty much 1:1 for my projects.  When switching between projects in ST, don’t forget to change the build system, too.
  2. Use 1 build system for python, but every time I switch projects, edit the build system with the proper python target.  No initial setup, but I’ve got to keep the build system open and remember where the venv is.

Enter PyProMan.  Basic, but it gets the job done and there’s almost no overhead if you decide later that you don’t want to use it anymore.


Put your projects in the $PROJ folder, and get started with a new virtualenv by running “proj pythonX.X” from that folder.  For the project “foo” there will be a new virtualenv in $VENV/foo.  Now, you can interact with any projects’ appropriate bin/ scripts by putting “proj” before the command (much like sudo).  Want to install a package for the project you’re in?  “proj pip install some_package” and it’s done.

But wait there’s more

The real reason this was put together was to make the SublimeText integration trivial.  Since our build system will always run the script we’re building from the project folder it lives in, we can use the same exact build cmd for all projects.  We don’t have to create and manage multiple build systems, we don’t have to edit it when switching projects.  “proj python $file” will figure out the appropriate python interpreter and hand it the rest of our arguments.  And we can use that command outside of the project folder as well, and still use the right virtualenv.  As long as you have put proj before python when executing a script, you can be sure it’s executing in the right environment.

Wow!  Anything else I should know?

Not really – two environment variables and two small bash scripts (that could be one).  For more information including my full SublimeText build system, check out the readme at


Written by delwinna

May 26, 2013 at 8:03 am

Posted in Uncategorized

Python: Word filtering and regex

leave a comment »

The Setup

Someone posed the question to me yesterday “given a list of all the permutations of vulgarities, how would you filter a relatively short message (say, 200 characters long) for one of those permutations?  This is time-sensitive, imagine on the order of potentially hundreds of checks a second.”

Asking for a bit more detail, I was told this list (array for you dirty non-python folk) was “over a million lines long”.  I had two immediate thoughts:

  1. That is a terrible representation of those permutations.  At least move to a basic trie and cut out (most) of your repetition.  Huge space savings if you’ve got similar words (likely, since they’re small variations of the same letters) and great savings in inclusion checks- O(k) instead of O(n), where n is the number of permutations, and k is the length of the longest permutation.
  2. Math senses tingling, primarily from combinatorics class.  There is NO WAY that this list is on the order of “millions”.  Since we can have multiple delimiters between characters, even conservative estimates for permutations of single words with restrictive assumptions and a small delimiter character set put us into the billions.  For one word.  Not buying it.

Read the rest of this entry »

Written by delwinna

April 26, 2012 at 3:54 pm

Posted in Uncategorized


leave a comment »

To start this thing off, here’s some of my undergrad work:

Differential Equations


Numerical Analysis I

Bonus project from summer graduation, a game I developed to familiarize myself with C# and XNA:


Written by delwinna

August 4, 2011 at 1:15 am

Posted in Uncategorized