Popular recipes by Eric Pruitt http://code.activestate.com/recipes/users/4170757/2011-01-09T16:32:22-08:00ActiveState Code RecipesRsync Algorithm (Python) 2011-01-09T16:32:22-08:00Eric Pruitthttp://code.activestate.com/recipes/users/4170757/http://code.activestate.com/recipes/577518-rsync-algorithm/ <p style="color: grey"> Python recipe 577518 by <a href="/recipes/users/4170757/">Eric Pruitt</a> (<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/delta/">delta</a>, <a href="/recipes/tags/diff/">diff</a>, <a href="/recipes/tags/patch/">patch</a>, <a href="/recipes/tags/python3/">python3</a>, <a href="/recipes/tags/rsync/">rsync</a>). Revision 4. </p> <p>This is a pure Python implementation of the <a href="http://samba.anu.edu.au/rsync/">rsync algorithm</a>. On my desktop (3.0GHz dual core, 7200RPM), best case throughput for target file hash generation and delta generation is around 2.9MB/s. Absolute worst case scenario (no blocks in common) throughput for delta generation is 200KB/s to 300KB/s on the same system.</p> <p>Tested in Python 2.5, 2.6, and 3.1. In 2.7, io.BufferedReader should yield the best throughput. On all other versions use __builtin__.open.</p> Cron-like Triggers (Python) 2010-12-07T22:52:10-08:00Eric Pruitthttp://code.activestate.com/recipes/users/4170757/http://code.activestate.com/recipes/577466-cron-like-triggers/ <p style="color: grey"> Python recipe 577466 by <a href="/recipes/users/4170757/">Eric Pruitt</a> (<a href="/recipes/tags/anacron/">anacron</a>, <a href="/recipes/tags/cron/">cron</a>, <a href="/recipes/tags/job/">job</a>, <a href="/recipes/tags/scheduler/">scheduler</a>, <a href="/recipes/tags/task/">task</a>). Revision 4. </p> <p>This module provides an easy to use interface for cron-like task scheduling. The latest version and its unit tests can be found at <a href="https://github.com/jameseric/cronex">github</a>.</p> Subprocess As Another User (Python) 2010-12-23T00:10:08-08:00Eric Pruitthttp://code.activestate.com/recipes/users/4170757/http://code.activestate.com/recipes/577495-subprocess-as-another-user/ <p style="color: grey"> Python recipe 577495 by <a href="/recipes/users/4170757/">Eric Pruitt</a> (<a href="/recipes/tags/login/">login</a>, <a href="/recipes/tags/subprocess/">subprocess</a>, <a href="/recipes/tags/user/">user</a>, <a href="/recipes/tags/windows/">windows</a>). Revision 3. </p> <p>Modifies the subprocess module and supplies a new class, LoginSTARTUPINFO, to launch processes as another user on Windows. Requires the pywin32 libraries, but the system ../lib/subprocess.py does not need to be modified.</p> <pre class="prettyprint"><code>&gt;&gt;&gt; import subprocesswin32 as subprocess &gt;&gt;&gt; sysuser = LoginSTARTUPINFO("username", "machine", "passwd123") &gt;&gt;&gt; stdout, stderr = subprocess.Popen("cmd.exe", stdout=subprocess.PIPE, ... startupinfo=sysuser).communicate() </code></pre> Serialize and Deserialize Securely (Python) 2009-11-04T19:57:41-08:00Eric Pruitthttp://code.activestate.com/recipes/users/4170757/http://code.activestate.com/recipes/576943-serialize-and-deserialize-securely/ <p style="color: grey"> Python recipe 576943 by <a href="/recipes/users/4170757/">Eric Pruitt</a> (<a href="/recipes/tags/cpickle/">cpickle</a>, <a href="/recipes/tags/pickle/">pickle</a>, <a href="/recipes/tags/serialize/">serialize</a>). Revision 19. </p> <p>A serialization library to serialize some of the more basic types. Does not suffer from the security flaws that cPickle and pickle do.</p>