Category archives: Snaking

Discussions of programming, particularly of programming Python

RSS feed of Snaking

Mocker's hidden gem...

Mocker has one uber-nice feature... it will mock out an object in basically all namespaces, so you can do a .proxy( 'mymodule.this.that' ) and have the resulting mock object replace the target "that" wherever it's been imported.  It won't, for instance, pick up references in lists, sets and the like, but for basic namespaces (dictionaries) ...

Continue reading

Stub/Mock-a-Process Module

Say you want to have a test suite that tests logic which runs command-line processes that should *not* be run on the test machine (e.g. they would cause the test machine's configuration to be totally messed up).  You want to test right down to the point where the call is made (i.e. you don't way ...

Continue reading

Anyone with PostgreSQL-on-EC2 recipes that work?

Seeing ridiculously slow PostgreSQL performance on an application.  Can't claim the application is particularly tightly coded for DB usage (too much ORM-ish-ness), so there's room to improve there, but right now we're seeing the same app 10x slower on the EC2 instances than on my (somewhat high-end) laptop... which makes me wonder if there's some ...

Continue reading

Python 2.5 PIL Gone in Lucid?

Why do half my tests suddenly fail, thinks me?  Me thinks, me looks, me finds no PIL!  Egadzooks, thinks me, thinking thinkily, what has become of my Python 2.5 PIL?  Aptitude thinks, and returns no thoughts of a Python 2.5 python-imaging?  Me thinks methinks me thoughts must turn to source.

[Update] For those who encounter ...

Continue reading

Duh! But upstart on 1.5 year old OS not so great...

My little experiment in Upstart is going to get rolled back, it appears.  While the system worked perfectly on modern Linux (Karmic Ubuntu), it wouldn't even recognize the scripts as valid on the Fedora 10 servers.  Given that the release of Upstart is so old, I'm thinking I'll wind up managing the 6-7 state transitions/events ...

Continue reading

Upstart seems kinda nice

Been doing system-level wiring for a low-level process for the last few hours, target is Fedora 10, so I can (theoretically) use Upstart for the init scripts... pretty slick stuff, the configs are simple, and I can create my 4-5 somewhat-interdependent processes such that they just kick each other off based on sending events.  The ...

Continue reading

Extract all fields of a DER-encoded PKCS7 file?

Say you have a PKCS#7 file with an embedded code-image as a field, how would you go about extracting that field's contents?  pyOpenSSL doesn't seem to have mechanisms for extracting/viewing arbitrary fields from PKCS7.  pyasn1 can load the structures, but of course it doesn't have access to the meaning of the fields, and it doesn't ...

Continue reading

Generic Binary-Data Pack/Unpack Module?

Having just written yet another module to pack/unpack data into a particular binary format, I'm wondering if someone has a more effective method they'd like to share?  I'm thinking some module that can handle RLE/TLV type stuff, complex "encodings" such as utf-8 continued charcters, struct-like pack/unpack for static elements, efficient loading of arrays, and bit-field ...

Continue reading

tgext.command 0.2 is out...


Adds support for instantiating Beaker's Cache from the config file (i.e. you can do cache-specific operations such as edge-triggered-cache-clearing in your utility scripts).  That's mostly useful if you have content-modifying scripts and want to clear/populate the cache when the script runs. Available in PyPI.

Don't make me guess, Gentle Spec Writer

Say you were writing a major standard, something implemented by thousands of companies. Say, one which specified, among other things, a format for public key files. Might it be appropriate to say "use a BER-encoded x509" certificate (with some (standard) x509 extensions)? Or would you:

  • declare that you require a "special" binary format for your ...

Continue reading