Popular recipes by Michael Grünewald http://code.activestate.com/recipes/users/4172244/2011-03-17T22:18:30-07:00ActiveState Code RecipesYAML include support (Python) 2011-03-17T22:18:30-07:00Michael Grünewaldhttp://code.activestate.com/recipes/users/4172244/http://code.activestate.com/recipes/577613-yaml-include-support/ <p style="color: grey"> Python recipe 577613 by <a href="/recipes/users/4172244/">Michael Grünewald</a> (<a href="/recipes/tags/yaml/">yaml</a>). </p> <p>This recipe shows how one can add <em>include</em> support to applications that use PyYAML.</p> Support and warranty information using WMI (Python) 2011-03-17T22:07:43-07:00Michael Grünewaldhttp://code.activestate.com/recipes/users/4172244/http://code.activestate.com/recipes/577123-support-and-warranty-information-using-wmi/ <p style="color: grey"> Python recipe 577123 by <a href="/recipes/users/4172244/">Michael Grünewald</a> (<a href="/recipes/tags/thinkpad/">thinkpad</a>, <a href="/recipes/tags/win32/">win32</a>, <a href="/recipes/tags/wmi/">wmi</a>). Revision 2. </p> <p>Shows the product code and serial number of a Thinkpad (of any computer with those information actually) and opens the Lenovo support and warranty pages for that system. It might work with other Lenovo computers too.</p> Progress Bar for Console Programs as Iterator (Python) 2010-03-26T20:04:02-07:00Michael Grünewaldhttp://code.activestate.com/recipes/users/4172244/http://code.activestate.com/recipes/576986-progress-bar-for-console-programs-as-iterator/ <p style="color: grey"> Python recipe 576986 by <a href="/recipes/users/4172244/">Michael Grünewald</a> (<a href="/recipes/tags/console/">console</a>, <a href="/recipes/tags/cui/">cui</a>, <a href="/recipes/tags/progress/">progress</a>). Revision 6. </p> <p>A small proxy iterator showing a progress bar on the console. Only works with iterators that provide a length (i.e. <code>len(iterator)</code> must be defined).</p> Show all url patterns in django (Python) 2010-03-26T20:04:08-07:00Michael Grünewaldhttp://code.activestate.com/recipes/users/4172244/http://code.activestate.com/recipes/576974-show-all-url-patterns-in-django/ <p style="color: grey"> Python recipe 576974 by <a href="/recipes/users/4172244/">Michael Grünewald</a> (<a href="/recipes/tags/django/">django</a>, <a href="/recipes/tags/urls/">urls</a>). Revision 5. </p> <p>This small script shows a simple formatted tree of all defined django url patterns.</p> string multi-partitioning (Python) 2010-03-26T20:03:59-07:00Michael Grünewaldhttp://code.activestate.com/recipes/users/4172244/http://code.activestate.com/recipes/577017-string-multi-partitioning/ <p style="color: grey"> Python recipe 577017 by <a href="/recipes/users/4172244/">Michael Grünewald</a> (<a href="/recipes/tags/partition/">partition</a>, <a href="/recipes/tags/string/">string</a>). Revision 6. </p> <p>Works like the <code>partition</code> method of strings in Python2.5+, but has support for more than one delimiter.</p> <p><em>Better description by Gabriel Genellina:</em></p> <blockquote> <p>Split the string at separator boundaries. The separators are searched from left to right, in the same order specified, and one after another. Unlike <code>partition</code>, all of them must be present (else <code>ValueError</code> is raised). Only one split per separator occurrence is done. Returns a list containing one more element than separators were given: first, text from beginning of the string up to (but not including) the first separator; the first separator itself; text between the first separator and the second one; the second separator; and so on. The last element contains all text following the last separator.</p> </blockquote> Caller and Callee (Python) 2010-03-26T20:04:11-07:00Michael Grünewaldhttp://code.activestate.com/recipes/users/4172244/http://code.activestate.com/recipes/576925-caller-and-callee/ <p style="color: grey"> Python recipe 576925 by <a href="/recipes/users/4172244/">Michael Grünewald</a> (<a href="/recipes/tags/callee/">callee</a>, <a href="/recipes/tags/caller/">caller</a>, <a href="/recipes/tags/debugging/">debugging</a>). Revision 4. </p> <p>A recipe to find out which function is the caller of the current function. </p> <p>The <code>caller</code> function can be helpful for debugging &mdash; if there is no real debugger available. In terms of software engineering (loose coupling etc.) this should not be used in production code though.</p> Thinkpad Turtle (Python) 2010-03-26T20:04:05-07:00Michael Grünewaldhttp://code.activestate.com/recipes/users/4172244/http://code.activestate.com/recipes/576985-thinkpad-turtle/ <p style="color: grey"> Python recipe 576985 by <a href="/recipes/users/4172244/">Michael Grünewald</a> (<a href="/recipes/tags/ctypes/">ctypes</a>, <a href="/recipes/tags/thinkpad/">thinkpad</a>, <a href="/recipes/tags/win32/">win32</a>, <a href="/recipes/tags/windows/">windows</a>). Revision 4. </p> <p>A small program utilizing the <code>ctypes</code> and <code>turtle</code> modules. You can <em>drive</em> the little turtle by turning your Thinkpad (which must have APS).</p> <p><em>Requirements:</em></p> <p>You need a newer Thinkpad (T41, T42, T43, T6x, R5x, R6x or any newer) and need to have the Active Protection System drivers (now called Lenovo Airbag Protection) installed.</p>