Popular recipes tagged "meta:loc=167"http://code.activestate.com/recipes/tags/meta:loc=167/2016-05-27T01:07:42-07:00ActiveState Code RecipesJSON Formatted Logging (Python) 2016-05-27T01:07:42-07:00Michael Blan Palmerhttp://code.activestate.com/recipes/users/4194130/http://code.activestate.com/recipes/580667-json-formatted-logging/ <p style="color: grey"> Python recipe 580667 by <a href="/recipes/users/4194130/">Michael Blan Palmer</a> (<a href="/recipes/tags/json/">json</a>, <a href="/recipes/tags/logging/">logging</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>I have created a package that outputs JSON formatted lines to a log file. It can make use of the standard logging parameters and/or take custom input. The use of JSON in the log file allows for easy filtering and processing.</p> Sierpinski Gasket (Python) 2016-02-20T10:41:24-08:00Paulo Cavalcantihttp://code.activestate.com/recipes/users/4189949/http://code.activestate.com/recipes/580614-sierpinski-gasket/ <p style="color: grey"> Python recipe 580614 by <a href="/recipes/users/4189949/">Paulo Cavalcanti</a> (<a href="/recipes/tags/fractal/">fractal</a>). </p> <p>Creates a Sierpinski Gasket, by recursively partitioning an initial triangle (a,b,c) into three or four new triangles.</p> Read tabular data from Excel spreadsheets the fast and easy way (Python) 2012-10-09T07:00:55-07:00wei.Liuhttp://code.activestate.com/recipes/users/4183853/http://code.activestate.com/recipes/578283-read-tabular-data-from-excel-spreadsheets-the-fast/ <p style="color: grey"> Python recipe 578283 by <a href="/recipes/users/4183853/">wei.Liu</a> (<a href="/recipes/tags/database/">database</a>). </p> <p>Sometimes you get an Excel spreadsheet (say, from the marketing departement) and you want to read tabular data from it (i.e. a line with column headers and lines of data). There are many ways to do this (including ODBC + mxODBC), but the easiest way I've found is this one : provide a file name and a sheet name, and read the data !</p> Script for cache invalidation at Amazon CloudFront (Python) 2011-07-05T14:40:58-07:00Andrey Nikishaevhttp://code.activestate.com/recipes/users/4176176/http://code.activestate.com/recipes/577779-script-for-cache-invalidation-at-amazon-cloudfront/ <p style="color: grey"> Python recipe 577779 by <a href="/recipes/users/4176176/">Andrey Nikishaev</a> (<a href="/recipes/tags/amazon/">amazon</a>, <a href="/recipes/tags/cloudfront/">cloudfront</a>). </p> <p>This script scans directories that was uploaded to CloudFront and build files index. When you modify some files, script automatically see what files was modified since the last update, and clear cache on CloudFront only for them.</p> <p>Usage: script.py data_dir [index_file] [dir_prefix] </p> <p>data_dir - path to directory with uploaded data</p> <p>index_file - path to files index</p> <p>dir_prefix - needed if you data_dir path is different from url at CloudFront.For example: Your data_dir is '/data' but url at CloudFront is <a href="http://url.com/social/data/" rel="nofollow">http://url.com/social/data/</a> so dir_prefix will be '/social/data/'</p> Synchronization Decorator for Class Methods (Python) 2010-03-13T10:11:07-08:00Rodney Drenthhttp://code.activestate.com/recipes/users/4050661/http://code.activestate.com/recipes/577105-synchronization-decorator-for-class-methods/ <p style="color: grey"> Python recipe 577105 by <a href="/recipes/users/4050661/">Rodney Drenth</a> (<a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/synchronize/">synchronize</a>, <a href="/recipes/tags/threads/">threads</a>). </p> <p>Synchronizes access to methods of a class with either an instance or class specific lock.</p> Holiday Leave (Python) 2010-07-01T13:21:09-07:00farciarzhttp://code.activestate.com/recipes/users/4172795/http://code.activestate.com/recipes/577280-holiday-leave/ <p style="color: grey"> Python recipe 577280 by <a href="/recipes/users/4172795/">farciarz</a> (<a href="/recipes/tags/argparse/">argparse</a>, <a href="/recipes/tags/console/">console</a>, <a href="/recipes/tags/holiday/">holiday</a>, <a href="/recipes/tags/leave/">leave</a>). </p> <p>Simple console tool that helps in maintenance your free days from work + basic tutorial how to use argparse in practice. It's clear and few lines of code. Enjoy! :-)</p> comixGetter (Python) 2007-06-24T13:24:47-07:00sami janhttp://code.activestate.com/recipes/users/4064232/http://code.activestate.com/recipes/522983-comixgetter/ <p style="color: grey"> Python recipe 522983 by <a href="/recipes/users/4064232/">sami jan</a> (<a href="/recipes/tags/web/">web</a>). Revision 2. </p> <p>Download daily comics from <a href="http://comics.com" rel="nofollow">comics.com</a> and <a href="http://ucomics/gocomics.com" rel="nofollow">ucomics/gocomics.com</a> e.g. peanuts, dilbert, calvin &amp; hobbes etc.</p> Binomial Queues (Python) 2007-05-01T14:01:44-07:00Irit Katrielhttp://code.activestate.com/recipes/users/4052961/http://code.activestate.com/recipes/511508-binomial-queues/ <p style="color: grey"> Python recipe 511508 by <a href="/recipes/users/4052961/">Irit Katriel</a> (<a href="/recipes/tags/algorithms/">algorithms</a>). </p> <p>A heap data structure that allows efficient merging of two heaps into one. See <a href="http://en.wikipedia.org/wiki/Binomial_heap" rel="nofollow">http://en.wikipedia.org/wiki/Binomial_heap</a></p> Read tabular data from Excel spreadsheets the fast and easy way (Python) 2005-12-14T20:36:30-08:00Nicolas Lehuenhttp://code.activestate.com/recipes/users/1599156/http://code.activestate.com/recipes/440661-read-tabular-data-from-excel-spreadsheets-the-fast/ <p style="color: grey"> Python recipe 440661 by <a href="/recipes/users/1599156/">Nicolas Lehuen</a> (<a href="/recipes/tags/database/">database</a>). Revision 3. </p> <p>Sometimes you get an Excel spreadsheet (say, from the marketing departement) and you want to read tabular data from it (i.e. a line with column headers and lines of data). There are many ways to do this (including ODBC + mxODBC), but the easiest way I've found is this one : provide a file name and a sheet name, and read the data !</p> Cloudscape - Create cloudscape DB. (Tcl) 2005-12-07T22:19:03-08:00Patrick Finneganhttp://code.activestate.com/recipes/users/1220635/http://code.activestate.com/recipes/461731-cloudscape-create-cloudscape-db/ <p style="color: grey"> Tcl recipe 461731 by <a href="/recipes/users/1220635/">Patrick Finnegan</a> (<a href="/recipes/tags/database/">database</a>). </p> <p>Create cloudscape database.</p> Efficient database trees (Python) 2004-04-28T10:48:08-07:00Ben Younghttp://code.activestate.com/recipes/users/1783111/http://code.activestate.com/recipes/280653-efficient-database-trees/ <p style="color: grey"> Python recipe 280653 by <a href="/recipes/users/1783111/">Ben Young</a> (<a href="/recipes/tags/database/">database</a>). Revision 2. </p> <p>Sometimes it can be hard to work out a way of efficiently representing a tree in the database. Combining modified preorder tree traversal with a parent child model allows most common queries to be represented in a single sql query. This example uses MySQLdb, but can easy be changed to use any DBI compatable module.</p> PortForwarder - TCL Sockets - (Tcl) 2002-12-01T13:46:07-08:00Norman Deppenbroekhttp://code.activestate.com/recipes/users/575411/http://code.activestate.com/recipes/164989-portforwarder-tcl-sockets-/ <p style="color: grey"> Tcl recipe 164989 by <a href="/recipes/users/575411/">Norman Deppenbroek</a> (<a href="/recipes/tags/network/">network</a>). </p> <p>PortForwarder forwards incoming tcp/ip data (defined port and ip address) towards an assigned remote ip address and port. Lowlevel security is done by checking on remote ip address (which is not secure but blocks)</p>