Search
New Code
Best Featured Online Classified Ads Solution 2.0
Magento 2 Frontend Builder 2.0
Devart SSIS DataFlow Components 1.6
Bytescout PDF Viewer SDK 8.7.0.2980
Readymade Job Site Script 2.0.1
SentiMask SDK Trial 1.0
Bytescout Spreadsheet SDK 2.9.0.1677
Taxi Booking Solution 1.0
Realtor Script - Vacation Rental Script 3.1
Chartered Accountant Listing Script 2.3
PHP Dice Clone Script 1.0.2
Hex Comparison 5.13
Realtor script, Property Portal Script 2.0.6
Bytescout BarCode Reader SDK 9.3.0.1728
RestoByte - Restaurant POS system 1.2
Top Code
Indiegogo Clone 3.0
PHP Image Resize Script 1.0
Jango Clone Script 1.0
Best Spotify Clone 1.0
Get Random Record Based on Weight 1.0.0
Travel Portal Script 9.29
Magento Product Designer 1.0
OFOS - Just Eat Clone Script 1.0
PrestaShop Upload Images Module 1.2.1
Trading Software 1.2.4
Deals and Discounts Website Script 1.0.2
Readymade MLM Products 2.01
ADO.NET Provider for ExactTarget 1.0
Solid File System OS edition 5.1
Classified Ad Lister 1.0
Code Listing by Trent Mick

Code 1-10 of 18   Pages: Go to  1  2  Next >>  page  






This is a quick snippet that I use occasionally to profile some pure-Python code, using hotshot. Basically it is this:


Put this @hotshotit decorator on the function you want to profile.
Run your code through some representative paces. The result will be a <functionname>.prof in the current directory.
Process the .prof file and print the top 20 hotspots with the given "show_stats.py" script.



A little script/function to download a given URL with a console progress meter. Usage:

python geturl.py http://example.com/downloads/bigfile.zip


(This is from an old post to python-list.)



Provides a _paths_from_path_patterns that will generate a list of paths from a list of path patterns. A "path pattern" can include glob chars. By default it generates a recursive listing of file paths, but: recursion can be turned off,...



Sometimes it is nice to print a banner line in the output of a command line script to group a section of output (say, in a log file). This little banner() function will center a given string in a line (using a character and length you can...



This is a recipe is often use for the mainline of my Python scripts. With this recipe your Python script will:


gracefully handle Ctrl+C (i.e. KeyboardInterrupt)
log an error (using the logging module) for uncaught exceptions,...



A more friendly mkdir() than Python's standard os.mkdir().
Limitations: it doesn't take the optional 'mode' argument
yet.



I have a lot of scripts that end up writing files (often build system stuff). Everytime I either end up writing the obvious quick content = open(path).read() or I re-implement a function that handles things like: making a backup, some typical...



effbot's ElementTree module (http://effbot.org/zone/element-index.htm) is an excellent way to work with XML. It has a lot of incarnations though so distributing code that uses it right now is little bit of a pain. Here is a snippet you might want...



Ask the user a question using raw_input() and looking something
like this:

QUESTION [Y/n/q]
...validate...


See also: Recipe 577058 (query yes/no), Recipe 577096 (query custom answers), Recipe 577098 (query...



Adding or subtracting a month to a Python datetime.date or datetime.datetime is a little bit of a pain. Here is the code I use for that. These functions return the same datetime type as given. They preserve time of day data (if that is at all...