Top-rated recipes by Mike 'Fuzzy' Partin http://code.activestate.com/recipes/users/4179778/top/2016-04-14T12:58:40-07:00ActiveState Code RecipesHuman readable output for bytes and seconds (Python)
2014-07-16T17:21:41-07:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/578910-human-readable-output-for-bytes-and-seconds/
<p style="color: grey">
Python
recipe 578910
by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a>
(<a href="/recipes/tags/humanize/">humanize</a>).
</p>
<p>A set of simple functions to represent bytes or seconds in a human readable form.</p>
Python AsciiColor and video attributes (Python)
2014-07-24T04:25:53-07:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/578908-python-asciicolor-and-video-attributes/
<p style="color: grey">
Python
recipe 578908
by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a>
(<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/dynamic_method/">dynamic_method</a>, <a href="/recipes/tags/metaprogramming/">metaprogramming</a>, <a href="/recipes/tags/python/">python</a>).
Revision 5.
</p>
<p>This is a subclass of a standard str object that adds methods for applying color, and video attributes to text.</p>
Simple curses based MySQL 'top' (Python)
2011-11-02T20:28:48-07:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/577936-simple-curses-based-mysql-top/
<p style="color: grey">
Python
recipe 577936
by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a>
(<a href="/recipes/tags/curses/">curses</a>, <a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/mysql/">mysql</a>, <a href="/recipes/tags/time/">time</a>).
Revision 3.
</p>
<p>This is little more than a modification of my previous recipe, however, I found it useful so I thought I would post it in the hopes that someone else would as well. There is color (BOLD white really) designation for 'Query' states vs others like 'Sleep'. </p>
Dependency resolution (Python)
2016-04-14T12:58:40-07:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/580642-dependency-resolution/
<p style="color: grey">
Python
recipe 580642
by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a>
(<a href="/recipes/tags/compare/">compare</a>, <a href="/recipes/tags/dependency/">dependency</a>, <a href="/recipes/tags/sort/">sort</a>, <a href="/recipes/tags/sorting/">sorting</a>).
</p>
<p>This recipe shows how to take a list of objects, each with their own list of dependencies, and resolve them to proper order. It includes some poor mans circular dependency detection (very poor mans).</p>
A Basic USe flag EDitor for Gentoo Linux supporting on-the-fly editing (Python)
2015-02-28T07:04:31-08:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/579028-a-basic-use-flag-editor-for-gentoo-linux-supportin/
<p style="color: grey">
Python
recipe 579028
by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a>
(<a href="/recipes/tags/parsing/">parsing</a>, <a href="/recipes/tags/popen/">popen</a>, <a href="/recipes/tags/subprocess/">subprocess</a>, <a href="/recipes/tags/user_input/">user_input</a>).
</p>
<p>This allows for on-the-fly editing. Simply drop abused.py into your path, and ensure that -a is not set in EMERGE_DEFAULT_OPTS in /etc/portage/make.conf. Then whenver you are installing new packages, use abused in place of emerge (eg: abused multitail) you will be presented with a list of use flags that are used in this action, and a prompt for editing any of them, simply hit enter with no changes to fire off the build.</p>
slurp.py (Regex based simple parsing engine) (Python)
2013-05-26T18:00:58-07:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/578532-slurppy-regex-based-simple-parsing-engine/
<p style="color: grey">
Python
recipe 578532
by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a>
(<a href="/recipes/tags/parser/">parser</a>, <a href="/recipes/tags/regex/">regex</a>, <a href="/recipes/tags/text_processing/">text_processing</a>).
</p>
<p>A parsing engine that allows you to define sets of patterns and callbacks, and process any I/O object in Pyton that has a readline() method.</p>
car.py (Ctypes ARchiver in PYthon [libarchive ffi wrapper]) (Python)
2013-05-28T04:02:15-07:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/578531-carpy-ctypes-archiver-in-python-libarchive-ffi-wra/
<p style="color: grey">
Python
recipe 578531
by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a>
(<a href="/recipes/tags/bzip2/">bzip2</a>, <a href="/recipes/tags/cpio/">cpio</a>, <a href="/recipes/tags/ctypes/">ctypes</a>, <a href="/recipes/tags/ffi/">ffi</a>, <a href="/recipes/tags/gzip/">gzip</a>, <a href="/recipes/tags/lzma/">lzma</a>, <a href="/recipes/tags/pax/">pax</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/tar/">tar</a>).
Revision 3.
</p>
<p>CTypes libarchive wrapper, handles extraction only with no arguments.</p>
rdd (mostly broken but shows how to do a few things in ruby) (Ruby)
2014-07-12T16:58:06-07:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/578034-rdd-mostly-broken-but-shows-how-to-do-a-few-things/
<p style="color: grey">
Ruby
recipe 578034
by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a>
(<a href="/recipes/tags/dd/">dd</a>, <a href="/recipes/tags/ftp/">ftp</a>, <a href="/recipes/tags/io/">io</a>, <a href="/recipes/tags/net_ftp/">net_ftp</a>, <a href="/recipes/tags/pipe/">pipe</a>, <a href="/recipes/tags/pipelining/">pipelining</a>, <a href="/recipes/tags/popen/">popen</a>, <a href="/recipes/tags/subprocess/">subprocess</a>).
Revision 3.
</p>
<p>Meant to be a slightly more "advanced" dd utility. Supporting FTP/File/STDIN as input streams, and File/STDOUT/PIPE as output targets, and sporting a progress display (very rudimentary atm), add lets you combine network, and file or pipe processing in a single command. But kind of ended up a mess, see the <a href="https://code.activestate.com/recipes/578907-python-awesome-dd/?in=user-4179778">Python version</a> which is pretty clean.</p>
Easy ansi color plus more. (Ruby)
2014-04-16T15:36:04-07:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/578018-easy-ansi-color-plus-more/
<p style="color: grey">
Ruby
recipe 578018
by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a>
(<a href="/recipes/tags/ansi/">ansi</a>, <a href="/recipes/tags/clear/">clear</a>, <a href="/recipes/tags/console/">console</a>, <a href="/recipes/tags/cursor/">cursor</a>, <a href="/recipes/tags/formatting/">formatting</a>, <a href="/recipes/tags/movement/">movement</a>, <a href="/recipes/tags/output/">output</a>, <a href="/recipes/tags/ruby/">ruby</a>, <a href="/recipes/tags/screen/">screen</a>, <a href="/recipes/tags/string/">string</a>, <a href="/recipes/tags/underline/">underline</a>).
</p>
<p>This quick class extends the base String class to add the ability to chain escape codes onto your output. For instance: puts 'String'.bold.underline.blink.red for something truly hideous. Aside from the colors (all are supported, but I haven't put in support for background colors as of the time of this post), cursor placement (ymmv based on the term type), screen clearing, bold, underline, blink reverse, conceal are all handled as well.</p>
DistCC 'top' (Python)
2013-12-01T11:19:56-08:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/577933-distcc-top/
<p style="color: grey">
Python
recipe 577933
by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a>
(<a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/curses/">curses</a>, <a href="/recipes/tags/distcc/">distcc</a>, <a href="/recipes/tags/distributed/">distributed</a>, <a href="/recipes/tags/monitor/">monitor</a>, <a href="/recipes/tags/pack/">pack</a>, <a href="/recipes/tags/struct/">struct</a>, <a href="/recipes/tags/top/">top</a>, <a href="/recipes/tags/unpack/">unpack</a>).
Revision 3.
</p>
<p>A small recipe for a curses based, 'top'-like monitor for DistCC. I know there is already distccmon-text, but I don't like it, and much prefer this sytle of monitoring. Note that I don't keep hosts around in the list like distccmon-gui/gnome. The screen is drawn for exactly what is currently in state. The terminal size is respected at initialization time, however resize events aren't handled. There is color designation of job types.</p>
Python Awesome DD (Python)
2014-07-12T07:29:59-07:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/578907-python-awesome-dd/
<p style="color: grey">
Python
recipe 578907
by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a>
(<a href="/recipes/tags/curses/">curses</a>, <a href="/recipes/tags/dd/">dd</a>, <a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/input/">input</a>, <a href="/recipes/tags/output/">output</a>, <a href="/recipes/tags/progress_bar/">progress_bar</a>).
Revision 3.
</p>
<p>Imagine if the *nix utilities 'dd', 'wget', and 'pv' had a baby. That baby would be named 'padd'. A 'dd' replacement (most commonly used options translate with no problem), that gives progress output like 'pv' and supports (currently) http(s) and ftp input sources, with more planned (sftp for one). Output support for ftp, sftp, and http(s) is also planned.</p>
lndir.py (short python version of the BSD/X11 lndir utility) (Python)
2013-05-28T07:21:28-07:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/578535-lndirpy-short-python-version-of-the-bsdx11-lndir-u/
<p style="color: grey">
Python
recipe 578535
by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a>
(<a href="/recipes/tags/directories/">directories</a>, <a href="/recipes/tags/files/">files</a>, <a href="/recipes/tags/os_walk/">os_walk</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>, <a href="/recipes/tags/walk/">walk</a>).
Revision 2.
</p>
<p>This should be valid for Python 2.6 and up, including the 3.x series.</p>