Popular recipes by Noah Spurrier http://code.activestate.com/recipes/users/103276/2007-12-07T15:32:02-08:00ActiveState Code RecipesPIL and Tkinter to display images. (Python) 2007-06-20T19:25:41-07:00Noah Spurrierhttp://code.activestate.com/recipes/users/103276/http://code.activestate.com/recipes/521918-pil-and-tkinter-to-display-images/ <p style="color: grey"> Python recipe 521918 by <a href="/recipes/users/103276/">Noah Spurrier</a> (<a href="/recipes/tags/graphics/">graphics</a>). Revision 3. </p> <p>Using PIL and Tkinter you can easily display images in a window.</p> Skeleton script Hello World (Python) 2007-12-07T15:32:02-08:00Noah Spurrierhttp://code.activestate.com/recipes/users/103276/http://code.activestate.com/recipes/528877-skeleton-script-hello-world/ <p style="color: grey"> Python recipe 528877 by <a href="/recipes/users/103276/">Noah Spurrier</a> (<a href="/recipes/tags/programs/">programs</a>). Revision 5. </p> <p>I write a lot of small scripts in Python. This is the template that I use to start most of my scripts. This gets me started with good documentation, argument parsing, and error handling.</p> Build a compressed self-extracting executable script on UNIX (Python) 2006-08-29T18:48:53-07:00Noah Spurrierhttp://code.activestate.com/recipes/users/103276/http://code.activestate.com/recipes/497000-build-a-compressed-self-extracting-executable-scri/ <p style="color: grey"> Python recipe 497000 by <a href="/recipes/users/103276/">Noah Spurrier</a> (<a href="/recipes/tags/programs/">programs</a>). </p> <p>This is a handy way to package a group of python modules into a single compressed self-extracting python executable script. This works on UNIX and Cygwin with Python 2.3 Final or later.</p> Pass Javascript arrays to PHP (PHP) 2005-05-16T11:45:33-07:00Noah Spurrierhttp://code.activestate.com/recipes/users/103276/http://code.activestate.com/recipes/414334-pass-javascript-arrays-to-php/ <p style="color: grey"> PHP recipe 414334 by <a href="/recipes/users/103276/">Noah Spurrier</a> (<a href="/recipes/tags/session/">session</a>). </p> <p>This is a Javascript function that will convert a Javascript array to a string in PHP serialized format. You can pass this string to a PHP script and easily unserialize it to a PHP array.</p> Minimal http upload cgi (Python) 2004-03-20T01:47:04-08:00Noah Spurrierhttp://code.activestate.com/recipes/users/103276/http://code.activestate.com/recipes/273844-minimal-http-upload-cgi/ <p style="color: grey"> Python recipe 273844 by <a href="/recipes/users/103276/">Noah Spurrier</a> (<a href="/recipes/tags/web/">web</a>). Revision 3. </p> <p>This is a bare-bones cgi file upload. It will display an upload form and save the uploaded files to disk.</p> Latin1 to ASCII -- The UNICODE Hammer (Python) 2003-11-10T11:06:49-08:00Noah Spurrierhttp://code.activestate.com/recipes/users/103276/http://code.activestate.com/recipes/251871-latin1-to-ascii-the-unicode-hammer/ <p style="color: grey"> Python recipe 251871 by <a href="/recipes/users/103276/">Noah Spurrier</a> (<a href="/recipes/tags/text/">text</a>). </p> <p>latin1_to_ascii -- The UNICODE Hammer -- AKA "The Stupid American"</p> <p>This takes a UNICODE string and replaces Latin-1 characters with something equivalent in 7-bit ASCII and returns a plain ASCII string. This function makes a best effort to convert Latin-1 characters into ASCII equivalents. It does not just strip out the Latin-1 characters. All characters in the standard 7-bit ASCII range are preserved. In the 8th bit range all the Latin-1 accented letters are converted to unaccented equivalents. Most symbol characters are converted to something meaningful. Anything not converted is deleted.</p> Finite State Machine (FSM) (Python) 2007-12-05T01:25:49-08:00Noah Spurrierhttp://code.activestate.com/recipes/users/103276/http://code.activestate.com/recipes/146262-finite-state-machine-fsm/ <p style="color: grey"> Python recipe 146262 by <a href="/recipes/users/103276/">Noah Spurrier</a> (<a href="/recipes/tags/algorithms/">algorithms</a>). Revision 2. </p> <p>This recipe shows a Finite State Machine (FSM) that can be used for small parsing tasks. The code is quite simple. The bulk of it is comments. In addition to state this FSM also maintains a user defined "memory". So this FSM is a Push-down Automata (PDA) since a PDA is a FSM + memory. This module contains an example function that demonstrates a simple RPN expression evaluator.</p> Build a white list of email address from "Sent Items" mailbox. (Python) 2003-04-16T17:48:52-07:00Noah Spurrierhttp://code.activestate.com/recipes/users/103276/http://code.activestate.com/recipes/194372-build-a-white-list-of-email-address-from-sent-item/ <p style="color: grey"> Python recipe 194372 by <a href="/recipes/users/103276/">Noah Spurrier</a> (<a href="/recipes/tags/files/">files</a>). </p> <p>This extracts all of the To addresses from a file in standard mbox format. It is used on a "Sent Items" mailbox to build an address white list. Presumably everyone you send email to is a candidate for an email white list.</p> Reading and writing mbox style mailbox files. (Python) 2002-10-18T12:06:30-07:00Noah Spurrierhttp://code.activestate.com/recipes/users/103276/http://code.activestate.com/recipes/157437-reading-and-writing-mbox-style-mailbox-files/ <p style="color: grey"> Python recipe 157437 by <a href="/recipes/users/103276/">Noah Spurrier</a> (<a href="/recipes/tags/sysadmin/">sysadmin</a>). </p> <p>This script demonstrates reading and writing an mbox style mailbox. This script is an mbox filter. It scans through an entire mbox and writes the messages to a new file. Each message is passed through a filter function which may modify the document or ignore it.</p> Binary search and insert in Python (Python) 2001-04-25T05:09:37-07:00Noah Spurrierhttp://code.activestate.com/recipes/users/103276/http://code.activestate.com/recipes/54159-binary-search-and-insert-in-python/ <p style="color: grey"> Python recipe 54159 by <a href="/recipes/users/103276/">Noah Spurrier</a> (<a href="/recipes/tags/search/">search</a>). Revision 3. </p> <p>This demonstrates a simple binary search through sorted data. A binary search is a basic algorithm provided by bisect in Python. The binary search can be summarized by two lines of code: list.sort() item_insert_point = bisect.bisect (list, item)</p>