Popular recipes tagged "meta:loc=166"http://code.activestate.com/recipes/tags/meta:loc=166/2016-12-17T19:08:33-08:00ActiveState Code Recipes[xtopdf] Publish Delimiter-Separated Values (DSV data) to PDF (Python) 2016-12-17T19:08:33-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580736-xtopdf-publish-delimiter-separated-values-dsv-data/ <p style="color: grey"> Python recipe 580736 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/commandline/">commandline</a>, <a href="/recipes/tags/csv/">csv</a>, <a href="/recipes/tags/data/">data</a>, <a href="/recipes/tags/files/">files</a>, <a href="/recipes/tags/formats/">formats</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdf_generation/">pdf_generation</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/tsv/">tsv</a>, <a href="/recipes/tags/utilities/">utilities</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>). </p> <p>This recipe shows how to publish delimiter-separated values (a commonly used tabular data format) to PDF, using the xtopdf toolkit for PDF creation. It lets the user specify the delimiter via one of two command-line options - an ASCII code or an ASCII character. As Unix filters tend to do, it can operate either on standard input or on input filenames given as command-line arguments. In the case of multiple inputs via files, each input goes to a separate PDF output file.</p> Python code clone detector (Don't Repeat Yourself) (Python) 2012-07-12T14:59:11-07:00frahttp://code.activestate.com/recipes/users/4182629/http://code.activestate.com/recipes/578206-python-code-clone-detector-dont-repeat-yourself/ <p style="color: grey"> Python recipe 578206 by <a href="/recipes/users/4182629/">fra</a> (<a href="/recipes/tags/analysis/">analysis</a>, <a href="/recipes/tags/clone/">clone</a>, <a href="/recipes/tags/code/">code</a>, <a href="/recipes/tags/dry/">dry</a>, <a href="/recipes/tags/duplication/">duplication</a>, <a href="/recipes/tags/parse/">parse</a>, <a href="/recipes/tags/similarity/">similarity</a>, <a href="/recipes/tags/static/">static</a>, <a href="/recipes/tags/syntax/">syntax</a>). Revision 2. </p> <p>Find duplicate code in Python 2/3 source files. Write a nice report about it.</p> <p>Works at the Abstract Syntax Tree level, which is a robust way to detect clones. See this <a href="http://francois.boutines.free.fr/python-3.2-report.html">code duplicated in the Python 3.2 standard library</a>.</p> <p><strong>Update</strong>: I cleaned the code a little bit, made it Python 2.7 compatible and faster.</p> ASIO Proxy (Python) 2011-04-17T15:08:30-07:00Aaron Riekenberghttp://code.activestate.com/recipes/users/4177692/http://code.activestate.com/recipes/577663-asio-proxy/ <p style="color: grey"> Python recipe 577663 by <a href="/recipes/users/4177692/">Aaron Riekenberg</a> (<a href="/recipes/tags/network/">network</a>). </p> <p>TCP proxy implemented using asio.</p> Routines for programmatically authenticating with the Google Accounts system at Google App-Engine. (Python) 2010-05-20T20:39:50-07:00Berendhttp://code.activestate.com/recipes/users/4173891/http://code.activestate.com/recipes/577217-routines-for-programmatically-authenticating-with-/ <p style="color: grey"> Python recipe 577217 by <a href="/recipes/users/4173891/">Berend</a> (<a href="/recipes/tags/auth/">auth</a>, <a href="/recipes/tags/authentication/">authentication</a>, <a href="/recipes/tags/gae/">gae</a>, <a href="/recipes/tags/google/">google</a>, <a href="/recipes/tags/http/">http</a>, <a href="/recipes/tags/sessions/">sessions</a>). Revision 2. </p> <p>This takes two calls, one to the ClientLogin service of Google Accounts, and then a second to the login frontend of App Engine.</p> <p>User credentials are provided to the first, which responds with a token. Passing that token to the _ah/login GAE endpoint then gives the cookie that can be used to make further authenticated requests.</p> Identifying network name (CIDR) for IPv4Address (Python) 2011-12-20T21:53:30-08:00DJChttp://code.activestate.com/recipes/users/4166733/http://code.activestate.com/recipes/576479-identifying-network-name-cidr-for-ipv4address/ <p style="color: grey"> Python recipe 576479 by <a href="/recipes/users/4166733/">DJC</a> (<a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/search/">search</a>, <a href="/recipes/tags/trie/">trie</a>). Revision 3. </p> <p>This program uses a digital trie search (Knuth 1998) to find the network of a given IPv4 address. It is fast, and can find nested subnets. </p> building a crontab to start jobs in hourly batches (administrators one-stop-shopping) (Python) 2007-05-28T00:41:47-07:00Peter Arwanitishttp://code.activestate.com/recipes/users/124365/http://code.activestate.com/recipes/521870-building-a-crontab-to-start-jobs-in-hourly-batches/ <p style="color: grey"> Python recipe 521870 by <a href="/recipes/users/124365/">Peter Arwanitis</a> (<a href="/recipes/tags/sysadmin/">sysadmin</a>). </p> <p>Task: Administrative job to run in my case 2300 jobs in a scheduled manner Restriction: Don't start two jobs at same schedule on same server</p> <p>Problems to solve that for: * align list of projects into batch of jobs with distinct servers * templated job creation * create a crontab * to start all this jobs from a starting schedule every hour * respect some restrictions that on some days and some hours no jobs should be started</p> <p>Thanks to builtin map() and standard-library time, datetime and timedelta to make that an ease at the end!</p> dal_5.py (Python) 2006-04-26T10:20:16-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/492213-dal_5py/ <p style="color: grey"> Python recipe 492213 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/files/">files</a>). </p> <p>DAL5 continues to refine the file system's interface and provides methods that should look similar to what most programmers are used to working with. Files have still not been completely abstracted away and all path names must be given as relative to the root. The path separator is defined in this module along with a list of characters for valid file and directory names.</p> Sorting with deep comparisons. (Python) 2002-07-18T19:40:54-07:00FMHj .http://code.activestate.com/recipes/users/560101/http://code.activestate.com/recipes/140328-sorting-with-deep-comparisons/ <p style="color: grey"> Python recipe 140328 by <a href="/recipes/users/560101/">FMHj .</a> . Revision 2. </p> <p>Sorts a list of objects by either attribute or index across a prioritized group of attributes, indices, or both.</p>