Popular recipes tagged "meta:loc=98"http://code.activestate.com/recipes/tags/meta:loc=98/2013-09-24T10:44:56-07:00ActiveState Code RecipesGenerator with lookahead (Python) 2013-09-24T10:44:56-07:00Rutger Saalminkhttp://code.activestate.com/recipes/users/4187940/http://code.activestate.com/recipes/578671-generator-with-lookahead/ <p style="color: grey"> Python recipe 578671 by <a href="/recipes/users/4187940/">Rutger Saalmink</a> (<a href="/recipes/tags/background/">background</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/generators/">generators</a>, <a href="/recipes/tags/lookahead/">lookahead</a>, <a href="/recipes/tags/performance/">performance</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>Python generators are a great way of reducing memory usage due to the lazy (on demand) generation of values. However, when the process-time of generating such a value is relatively high, we can improve performance even more by obtaining the next n values of the generator in a separate thread in the background. Hence, the BackgroundGenerator.</p> Win32 named mutex class for system-wide mutex (Python) 2011-07-15T21:12:40-07:00Ben Hoythttp://code.activestate.com/recipes/users/4170919/http://code.activestate.com/recipes/577794-win32-named-mutex-class-for-system-wide-mutex/ <p style="color: grey"> Python recipe 577794 by <a href="/recipes/users/4170919/">Ben Hoyt</a> (<a href="/recipes/tags/ctypes/">ctypes</a>, <a href="/recipes/tags/lock/">lock</a>, <a href="/recipes/tags/mutex/">mutex</a>, <a href="/recipes/tags/process/">process</a>, <a href="/recipes/tags/threading/">threading</a>, <a href="/recipes/tags/win32/">win32</a>, <a href="/recipes/tags/windows/">windows</a>). </p> <p>NamedMutex is a class for using Windows (Win32) named mutexes for system-wide locks. For example, we use these to lock system-wide log files that multiple processes can write to.</p> Simple LF Audio Oscilloscope Using Standard Python. (Python) 2011-04-07T17:17:57-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577644-simple-lf-audio-oscilloscope-using-standard-python/ <p style="color: grey"> Python recipe 577644 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/anim/">anim</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/display/">display</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/oscilloscope/">oscilloscope</a>, <a href="/recipes/tags/scope/">scope</a>, <a href="/recipes/tags/sound/">sound</a>). </p> <p>AudioScope.py</p> <p>I think this might be a first for both Python.</p> <p>Initially uploaded to LXF, now also here under the MIT licence.</p> <p>I am building a kids level seismometer and wanted to use standard Python inside Linux.</p> <p>This DEMO code was my starter idea and looks as though using standard ASCII only might just work a real treat.</p> <p>I've issued it to LXF under the MIT licence for future reasons.</p> <p>It doesn't look much on screen except that the waveform(s) shown is/are a basic visual, electrical representation of your voice. ;o)</p> <p>It is possible to link the earphone socket on this notebook to the mic input and start the Audio Function Generator, elsewhere in this site, in a separate Python terminal and see those waveforms inside the AudioScope.py`s own Python terminal.</p> <p>This grabs a 1 second 8KB burst, and then displays it onto the Python terminal. The timebase, amplitude, trigger, single shot and others are not included but the main grab and display using /dev/dsp is shown. This can be made platform independent by changing the /dev/dsp to something external like the Arduino Dev Board. This uses STANDARD Python 2.5.x and later and tested on PCLinuxOS 2009 and Debian 6.0.0.</p> <p>Enjoy finding simple solutions to often very difficult problems.</p> <p>Bazza, G0LCU.</p> qemu-nbd Python wrapper (Python) 2011-03-01T20:11:45-08:00Slava Yansonhttp://code.activestate.com/recipes/users/4176967/http://code.activestate.com/recipes/577593-qemu-nbd-python-wrapper/ <p style="color: grey"> Python recipe 577593 by <a href="/recipes/users/4176967/">Slava Yanson</a> (<a href="/recipes/tags/kvm/">kvm</a>, <a href="/recipes/tags/libvirt/">libvirt</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/qemu/">qemu</a>, <a href="/recipes/tags/virtualization/">virtualization</a>). </p> <p>A simple Python wrapper that makes it easier to mount virtual machine disk images to a local machine.</p> <p>Requires qemu-nbd package installed.</p> Post code to Pastebin.com (JavaScript) 2010-12-06T17:56:41-08:00Nathan Rambeckhttp://code.activestate.com/recipes/users/4171896/http://code.activestate.com/recipes/577489-post-code-to-pastebincom/ <p style="color: grey"> JavaScript recipe 577489 by <a href="/recipes/users/4171896/">Nathan Rambeck</a> (<a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/pastebin/">pastebin</a>). </p> <p>This is an updated version of another recipe (#577170) to post selected text to <a href="http://pastebin.com" rel="nofollow">pastebin.com</a>. This version uses the latest API. You'll want to change the following variables to your preferences: email, nick, expiry.</p> Bible Verse Quiz - verse.py (Python) 2010-02-12T04:19:44-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577044-bible-verse-quiz-versepy/ <p style="color: grey"> Python recipe 577044 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/bible/">bible</a>, <a href="/recipes/tags/quiz/">quiz</a>, <a href="/recipes/tags/verse/">verse</a>, <a href="/recipes/tags/_versematch_/">_versematch_</a>). Revision 3. </p> <p>Encapsulate verses from the Bible and support quizzing over them.</p> <p>The Verse class in this module is far superior to the one implemented in Java. All quizzing/testing capabilities are imported from another module.</p> unix subprocess wrapper (Python) 2008-07-29T07:11:17-07:00Pádraig Bradyhttp://code.activestate.com/recipes/users/1890175/http://code.activestate.com/recipes/576387-unix-subprocess-wrapper/ <p style="color: grey"> Python recipe 576387 by <a href="/recipes/users/1890175/">Pádraig Brady</a> (<a href="/recipes/tags/group/">group</a>, <a href="/recipes/tags/popen/">popen</a>, <a href="/recipes/tags/subprocess/">subprocess</a>, <a href="/recipes/tags/unix/">unix</a>). Revision 2. </p> <p>I have used this for ages to control child processes (and all their children). Some of the existing subprocess module was based on this, but I find this simpler for my uses at least.</p> <h4>Example:</h4> <pre class="prettyprint"><code>import subProcess process = subProcess.subProcess("your shell command") process.read() #timeout is optional handle(process.outdata, process.errdata) del(process) </code></pre> Easy interact with Mac Os user, (Python) 2004-09-05T16:26:58-07:00Matteo Rattottihttp://code.activestate.com/recipes/users/2021467/http://code.activestate.com/recipes/303529-easy-interact-with-mac-os-user/ <p style="color: grey"> Python recipe 303529 by <a href="/recipes/users/2021467/">Matteo Rattotti</a> . </p> <p>EasyDialogs give you the chance to connect a light Gui to your script, so user can interact and pass parameters to the script without using terminal.</p> Returning results from the XML interface at searchhippo.com (Python) 2002-06-23T14:07:20-07:00Bill Bellhttp://code.activestate.com/recipes/users/98151/http://code.activestate.com/recipes/135130-returning-results-from-the-xml-interface-at-search/ <p style="color: grey"> Python recipe 135130 by <a href="/recipes/users/98151/">Bill Bell</a> (<a href="/recipes/tags/web/">web</a>). </p> <p>Semi-lazy interrogation of <a href="http://searchhippo.com" rel="nofollow">searchhippo.com</a> returns a virtual array of the search engine's records.</p>