Popular recipes tagged "meta:loc=158"http://code.activestate.com/recipes/tags/meta:loc=158/2013-09-10T21:23:58-07:00ActiveState Code Recipes Pseudo-3D effect in text mode... (Bash) 2013-09-10T21:23:58-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578655-pseudo-3d-effect-in-text-mode/ <p style="color: grey"> Bash recipe 578655 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/3d/">3d</a>, <a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/colour/">colour</a>, <a href="/recipes/tags/display/">display</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/text/">text</a>). </p> <p>This is just a simple DEMO to display a pseudo-3D effect using a bash script. It generates a recessed box and a button and writes some thext inside bot.</p> <p>There are two pieces of code, one for Linux, and one for OSX 10.7.5...</p> <p>The Linux version also works on OSX 10.7.5 but is harder to see so a near identical version using the default OSX terminal colours was craeted instead.</p> <p>You will have to split the two code pieces up yourself to run...</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> <p>Bazza...</p> PseudoStruct (Python) 2012-11-25T03:43:06-08:00Matthew Zipayhttp://code.activestate.com/recipes/users/4183355/http://code.activestate.com/recipes/578349-pseudostruct/ <p style="color: grey"> Python recipe 578349 by <a href="/recipes/users/4183355/">Matthew Zipay</a> (<a href="/recipes/tags/datastructures/">datastructures</a>, <a href="/recipes/tags/namedtuple/">namedtuple</a>, <a href="/recipes/tags/record/">record</a>). </p> <p>This is a recipe for a Python "data object." It is similar in function to namedtuple (<a href="http://code.activestate.com/recipes/500261/" rel="nofollow">http://code.activestate.com/recipes/500261/</a>) and recordtype (<a href="http://code.activestate.com/recipes/576555-records/" rel="nofollow">http://code.activestate.com/recipes/576555-records/</a>) in that it is a simple container for data, but is designed to meet three specific goals:</p> <ol> <li>Easy to subclass data objects.</li> <li>Get/set speed comparable to a simple class.</li> <li>Minimal memory consumption per instance.</li> </ol> Flash_N_Fade Using Standard Text Mode Python For Linux And Windows... (Python) 2012-07-15T18:38:43-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578216-flash_n_fade-using-standard-text-mode-python-for-l/ <p style="color: grey"> Python recipe 578216 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/fade/">fade</a>, <a href="/recipes/tags/flash/">flash</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/windows/">windows</a>). </p> <p>This DEMO shows how to fade text in shades of grey and also flash with inverse_flash along with simultaneous differing frequency beeps.</p> <p>There are 2 code snippets that WILL need to be separated before use. One is a Linux version and the other a Windows 32 bit version. There is an AMIGA version but that is for much later.</p> <p>There are NO notes inside the code so you will have to see the code as to how it works. It is SOOO simple that notes are/were unnecessary...</p> <p>Bazza, G0LCU...</p> For AMIGA-Heads Only. Generating An Audio Signal In Text Mode Python. (Python) 2011-11-30T21:23:20-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577971-for-amiga-heads-only-generating-an-audio-signal-in/ <p style="color: grey"> Python recipe 577971 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/amiga/">amiga</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/e_uae/">e_uae</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/winuae/">winuae</a>). </p> <p>This DEMO is not for the big guns. It is aimed at those who still use a minimum of an ancient classic AMIGA A1200(HD), E-UAE, WinUAE, of which there are still a lot of us about...</p> <p>No comments about the use of "eval()" as Python Version 1.4.0 does not have "int()" and this is designed to work on all versions of Python available for the above platform. See the code for minimum requirements and much more information.</p> <p>MANY THANKS to Irmen de Jong for porting early versions of Python to the classic AMIGA to give we lowly users a taste of what was/is to come.</p> <p>This code will probably make the professionals cough a little, but, boy what fun it is to see how powerful Python can be on an open platform like the AMIGA.</p> <p>Written in such a way that anyone can understand how it works...</p> <p>I really don't care how you vote this as it is for those, including professionals, who enjoy messing with AMIGA variants purely for fun and relaxation, and, to......</p> <p>Enjoy finding simple solutions to often VERY difficult problems... ;o)</p> <p>Bazza, G0LCU...</p> Test byt2str Module (Python) 2009-10-08T19:49:28-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/576926-test-byt2str-module/ <p style="color: grey"> Python recipe 576926 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/byt2str/">byt2str</a>, <a href="/recipes/tags/testing/">testing</a>). Revision 2. </p> <p>To ensure that the "byt2str" module operates correctly, the following unit test has been devised. This recipe should ensure the correctness of the code and validate all corrections for accuracy when run. If you are not familiar with the "unittest" or "test" modules, this code may of be interest for the purpose of developing your own library validation suites. Testing code is important for providing a certain amount of assurance that the code being run is correct. If the code is changed incorrectly, a test like this should be able to detect a problem.</p> Control CPU Usage by using ctypes (Win32 Platform) (Python) 2009-01-26T09:32:34-08:00Shao-chuan Wanghttp://code.activestate.com/recipes/users/4168519/http://code.activestate.com/recipes/576634-control-cpu-usage-by-using-ctypes-win32-platform/ <p style="color: grey"> Python recipe 576634 by <a href="/recipes/users/4168519/">Shao-chuan Wang</a> (<a href="/recipes/tags/cpu_usage/">cpu_usage</a>, <a href="/recipes/tags/ctypes/">ctypes</a>, <a href="/recipes/tags/system_programming/">system_programming</a>, <a href="/recipes/tags/win32/">win32</a>). Revision 3. </p> <p>This program will make your cpu work at a given cpu usage. It should be also able to work on machines with multi-processors. The program has been tested on Windows xp sp2 with python of version 2.5.4.</p> <p>The implementation is based on the fact that it will adjust the ratio of being busy over being idle in the main process to approach the target cpu usage rate. </p> Good enough templating (Python) 2005-10-08T22:27:00-07:00Kevin Schluffhttp://code.activestate.com/recipes/users/1496147/http://code.activestate.com/recipes/440629-good-enough-templating/ <p style="color: grey"> Python recipe 440629 by <a href="/recipes/users/1496147/">Kevin Schluff</a> (<a href="/recipes/tags/text/">text</a>). Revision 2. </p> <p>A small, powerful templating language using template strings embedded in standard Python syntax. Templates are valid Python source, compiled directly to bytecode. Variable substitution is performed using 'string.Template'.</p> Shuffle Merge Files (Python) 2005-08-15T08:20:33-07:00Alexandru Iosuphttp://code.activestate.com/recipes/users/2554635/http://code.activestate.com/recipes/439319-shuffle-merge-files/ <p style="color: grey"> Python recipe 439319 by <a href="/recipes/users/2554635/">Alexandru Iosup</a> (<a href="/recipes/tags/files/">files</a>). </p> <p>This recipe solves the problem of shuffle-merging files -- interlacing (shuffle-merging) many small text files into one large text file, while preserving the order of the lines from within the small files.</p>