Top-rated recipes tagged "meta:loc=4" Code RecipesLinear equations solver in 3 lines (Python) 2005-01-31T22:06:30-08:00Maxim Krikun <p style="color: grey"> Python recipe 365013 by <a href="/recipes/users/1085177/">Maxim Krikun</a> (<a href="/recipes/tags/programs/">programs</a>). Revision 2. </p> <p>Just a little bit of hack: a linear equations solver using eval and built-in complex numbers:</p> <pre class="prettyprint"><code>&gt;&gt;&gt; solve("x - 2*x + 5*x - 46*(235-24) = x + 2") 3236.0 </code></pre> Directories tree (Bash) 2013-10-11T07:11:24-07:00greg zakharov <p style="color: grey"> Bash recipe 578684 by <a href="/recipes/users/4184115/">greg zakharov</a> (<a href="/recipes/tags/tree/">tree</a>). </p> <p>Imitation of tree -d command.</p> Linear equations solver in 3 lines (Python) 2013-03-07T07:33:09-08:00Deepak <p style="color: grey"> Python recipe 578481 by <a href="/recipes/users/4183429/">Deepak</a> (<a href="/recipes/tags/programs/">programs</a>). </p> <p>Just a little bit of hack: a linear equations solver using eval and built-in complex numbers:</p> <pre class="prettyprint"><code>&gt;&gt;&gt; solve("x - 2*x + 5*x - 46*(235-24) = x + 2") 3236.0 </code></pre> Komodo JS Macro - use vertical editor tabs positioned to the right (JavaScript) 2010-09-10T02:53:33-07:00Todd Whiteman <p style="color: grey"> JavaScript recipe 577386 by <a href="/recipes/users/2666241/">Todd Whiteman</a> (<a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/layout/">layout</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/tab/">tab</a>). </p> <p>A <a href="">Komodo</a> JavaScript macro that can be used to position the editor tabs on the right side and shown vertically.</p> <p>Additional layouts (left, right, up, down, vertical, horizontal) can be made with different combinations, see here for the Mozilla tabbox positioning documentation: <a href="" rel="nofollow"></a></p> Shoelace Formula for polygonal area (Python) 2017-07-17T05:53:45-07:00Paddy McCarthy <p style="color: grey"> Python recipe 580812 by <a href="/recipes/users/398009/">Paddy McCarthy</a> (<a href="/recipes/tags/2d/">2d</a>, <a href="/recipes/tags/area/">area</a>). </p> <p>Copied, by author from "Paddy3118 Go deh!: Python investigation of the Shoelace Formula for polygonal area <a href="" rel="nofollow"></a> " Where there is more meat on the bone (under a different license though).</p> Multiplatform compability (Python) 2011-07-24T05:10:04-07:00Yaşar Arabacı <p style="color: grey"> Python recipe 577804 by <a href="/recipes/users/4178739/">Yaşar Arabacı</a> . </p> <p>I use this small code close to the head of section of my codes if I'm going to use range function to make it behave same in both python 3 and python 2</p> Get a list from a ConfigParser option (Python) 2011-05-13T13:53:56-07:00Georges Martin <p style="color: grey"> Python recipe 577694 by <a href="/recipes/users/4177973/">Georges Martin</a> (<a href="/recipes/tags/configparser/">configparser</a>, <a href="/recipes/tags/list/">list</a>, <a href="/recipes/tags/option/">option</a>). Revision 2. </p> <p>Return a list from a ConfigParser option. By default, split on a comma and strip whitespaces.</p> Accessing cursors by field name (Python) 2010-04-09T22:50:04-07:00Ricardo Araoz <p style="color: grey"> Python recipe 577186 by <a href="/recipes/users/4173628/">Ricardo Araoz</a> (<a href="/recipes/tags/cursor/">cursor</a>, <a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/datastructures/">datastructures</a>, <a href="/recipes/tags/field/">field</a>, <a href="/recipes/tags/name/">name</a>). </p> <p>This class allows you to access the rows of a cursor by field name.</p> Add Commas to a Number (Tcl) 2001-09-09T21:21:34-07:00Keith Vetter <p style="color: grey"> Tcl recipe 68381 by <a href="/recipes/users/130056/">Keith Vetter</a> (<a href="/recipes/tags/text/">text</a>). </p> <p>Takes a number and inserts a comma (or separator of your choice) between every third digit.</p> hollow (Perl) 2015-03-08T22:16:06-07:00Jyh Chong <p style="color: grey"> Perl recipe 579033 by <a href="/recipes/users/4191780/">Jyh Chong</a> . </p> <h4 id="usrbinperl-w">!/usr/bin/perl -w</h4> <pre class="prettyprint"><code> print "Content-type: text/html\n\n"; print "Hello, world"; </code></pre> Change console title on clock (Batch) 2012-11-14T19:04:20-08:00greg zakharov <p style="color: grey"> Batch recipe 578327 by <a href="/recipes/users/4184115/">greg zakharov</a> (<a href="/recipes/tags/clock/">clock</a>). </p> <p>Use Ctrl+C to break executing script.</p> How to read millions of hexadecimal numbers into a numpy array quickly (Python) 2012-06-27T06:03:40-07:00Oren Tirosh <p style="color: grey"> Python recipe 578177 by <a href="/recipes/users/2033964/">Oren Tirosh</a> (<a href="/recipes/tags/numpy/">numpy</a>). </p> <p>The numpy.fromfile() function supports binary formats or decimal text. How do you read millions of hexadecimal numbers quickly?</p> Recursive defaultdict (Python) 2012-03-01T19:00:04-08:00thom neale <p style="color: grey"> Python recipe 578057 by <a href="/recipes/users/4176069/">thom neale</a> (<a href="/recipes/tags/defaultdict/">defaultdict</a>). </p> <p>A defaultdict that yields a defaultdict that yields a defaultdict, etc...</p> Yet another prime number sieve (Python) 2011-10-10T07:49:08-07:00Maxim Krikun <p style="color: grey"> Python recipe 577901 by <a href="/recipes/users/4168574/">Maxim Krikun</a> (<a href="/recipes/tags/sieve/">sieve</a>). </p> <p>A one-liner that returns the list of prime numbers up to n. The inner lambda is the sieve.</p> Add support for the "in" operator to the attributes map of minidom elements (Python) 2006-06-23T18:54:14-07:00Walker Hale <p style="color: grey"> Python recipe 496817 by <a href="/recipes/users/2928779/">Walker Hale</a> (<a href="/recipes/tags/xml/">xml</a>). Revision 2. </p> <p>When you parse XML using minidom, you can get a map of attributes for any element. The problem is that using the "in" operator on this map will raise an exception. These three lines of code will fix that.</p> toMB (Tcl) 2005-01-23T19:52:21-08:00Patrick Finnegan <p style="color: grey"> Tcl recipe 364232 by <a href="/recipes/users/1220635/">Patrick Finnegan</a> (<a href="/recipes/tags/windows/">windows</a>). </p> <p>Proc to convert bytes to megabytes.</p> Generator for splitting a string on parts of equal size (Python) 2004-08-26T03:05:46-07:00Dmitry Vasiliev <p style="color: grey"> Python recipe 302069 by <a href="/recipes/users/1571302/">Dmitry Vasiliev</a> (<a href="/recipes/tags/shortcuts/">shortcuts</a>). </p> <p>Example: &lt;pre&gt;</p> <pre class="prettyprint"><code>&gt;&gt;&gt; list(splitIterator("102030405", 2)) ['10', '20', '30', '40', '5'] &lt;/pre&gt; </code></pre> Grabbing text between HTML tags (Python) 2003-08-20T09:46:47-07:00Brendan Barry <p style="color: grey"> Python recipe 217019 by <a href="/recipes/users/1326592/">Brendan Barry</a> (<a href="/recipes/tags/web/">web</a>). </p> <p>Just a snippet. I needed to grab the data between &lt;LI&gt; list item &lt;/LI&gt; tags. Highly annoying that I couldn't find it anywhere else.</p> Generating a list of prime numbers in one statement (Python) 2002-11-14T03:43:47-08:00Pierre Denis <p style="color: grey"> Python recipe 162479 by <a href="/recipes/users/112275/">Pierre Denis</a> . </p> <p>The following expression generates the list of prime numbers strictly inferior to a given positive integer N.</p> fibonacci (Python) 2002-04-04T08:08:41-08:00anurag uniyal <p style="color: grey"> Python recipe 67677 by <a href="/recipes/users/127639/">anurag uniyal</a> (<a href="/recipes/tags/algorithms/">algorithms</a>). Revision 2. </p> <p>One Liner fibonacci series generator</p>