|
This page contains (hopefully usefull) quick & dirty Python programs. I created these programs because I needed them. I decided to put them in the public domain. Feel free to reuse and tweak them.
stripscripts.py - stripscripts 1.0p - Script stripper |
This script will scan a directory (and its subdirectories) and disable all scripts (javascript, vbscript...) from .html and .htm files (The scripts will not be deleted, but simply deactivated, so that you can review them later if you like.) Can be usefull for sites you have downloaded with HTTrack or similar tools. No more nosey or buggy scripts in your local html files. Syntax : Example : |
snapper.py - Snapper 1.2p - System snapshop |
This script will scan a directory (and its subdirectories), compute SHA-1 (Secure Hash Algorithm) for specific files (according to their extensions) and ouput a CSV file (suited for loading into a spreadsheet editor, a database, or simply comparing using a diff or ExamDiff.). Usefull for system tampering detection (kind of poor man's TripWire). You can redirect the output of this script to a file. Directory to scan and extensions are hardcoded in the script. Feel free to tweak them to suit your needs. |
newsarchiver.py - newsArchiver 1.1p - Usenet archiver |
This script will download all available message from the desired Usenet group with NNTP and save them as plain text files. Usefull for bulk group archiving, even if messages fall beyond the server delete threshold. Each message will be saved in seperate file (filenames are choosen according to the group and message ID, eg. comp_lang_python_108476). You can interrupt the script anytime (by pressing CTRL+C) and re-run it later. The script will resume and download only the missing messages. Read script comments for configuration information. |
email_extractor.py - Email Extractor 1.0p - Email addresses extractor |
This script takes whatever you throw at stdin (text file, html, EXE...) and extracts email addresses. eg. This script can be used for whatever you want, except spamming ! |
autozip.py - Auto-Zip 1.0p - Auto-zipper |
This script will scan a directory (and its subdirectories) and will automatically zip found files (according to their extensions). I use this script to automatically ZIP the backups of my SQL server. This script does not use Python's internal ZIP routines. This script requires InfoZip's ZIP.EXE to be present in the path (see script comments for URL). Extensions to zip are hardcoded in the script. |
ultima_s.py - Ult*ma Strasbourg list-dumper 1.0 |
This script will fetch the entire catalog from Ult*ma Strabourg (french CD and DVD bargains). eg. Comments in this script are in french (sorry !). |
doublesdetector.py - Doubles detector 1.0p - Duplicate file finder |
This script will find files that have the same content (in several directories or drives), whatever their name, date, time or attributes. eg. |
kupdate101.py - KAV/AVP update - Kasperksy antivirus signatures updater |
This script is a handy replacement of the KAV/AVP antivirus auto-update feature. It will download only necessary files and unzip them in the right directory. You can schedule this script everyday to be up-to-date. |
pypack002.py - pyPack 0.0.2 - Python script packer |
Packs individual python scripts in pure text. Benefits:
Of course, pyPack is itself packed with pyPack ! ;-) |
fum01dev3.py - fastUnixMailbox 0.1 DEV 3 - Fast Unix mailbox reader |
This module is a replacement of Python's Unixmailbox module. fastUnixMailbox is much faster:
You'll be able to access the content mailbox files very quickly. It's especially usefull on large mailboxes. |
scsv.py - Simple CSV file reader 0.0.2 - Fast and precise CSV/TSV file reader |
This parser can read:
This parser:
This class is very easy to use : open the file, and use Note on 2003-05-06: This module is deprecated and will no longer be updated. Python has CSV support integrated since version 2.3. You'd probably better switch to Python 2.3's CSV module and drop SCSV. |
html2csv.py - HTML tables to CSV converter |
A coarse "HTML tables to CSV" (Comma-Separated Values) converter. All tables from the HTML file will be converted (as they occur) into a single CSV file, suited for loading into a spreadsheet editor.
To convert a bunch of HTML files, just type: This is also an example of the use of the HTMLParser module. |
gossyp - gossips from the internet |
See http://sebsauvage.net/python/gossyp/ for more details. |
webGobbler - mix random images from the internet |
See http://sebsauvage.net/python/webgobbler/ for more details. |
delxml2html.py - del.icio.us XML export to HTML converter |
HTML export of del.icio.us sucks. It's not in chronological order. This program takes the XML export of del.icio.us and converts it to an HTML page. It's a nice way to have all your del.icio.us bookmarks in a single HTML page (like mine). Instructions:
PS: Yes, I know XSLT exists. But XSLT sucks. |
myradioplayer.py - No-brainer "Play the music I want" |
This is a no-brainer program "Play the music I want". It's dead simple:
Quality is low (MP3 at 64 kbits/s most the time), but you'll get almost any song you want ! Give it a try with "u2", "manson" or "wild horses". How can this be ? Well, this program simply uses RadioBlogClub.com to find the music you want. THIS PROGRAM DOES NOT DOWNLOAD A SINGLE BYTE OF MUSIC FROM THE INTERNET. So don't bother suing me, you'd be wasting your time. Requirements: An MP3 player which supports the M3U playlist format and HTTP streaming. About proxy support: If you use a proxy, you can set the environment variable HTTP_PROXY. Example: SET HTTP_PROXY=http://proxy.myisp.com:3128 |
cbscraper.py - ASPN Python cookbook scraper |
ASPN Python cookbook (http://aspn.activestate.com/ASPN/Cookbook/Python) is a great site with tons of recipes for Python. Shame is: You cannot browse these snippets offline. This program downloads all the recipes and packs them in a single html file. This is nice for offline browsing while travelling, or taking on a USB key. This is also handy for quick full-text search. For those interested, I keep a copy of the result of this script here. It's updated once a while. |
bashfr_download.py - bashfr.org downloader |
This program downloads the whole bashfr.org archive and writes it in a single HTML file. Nice for offline reading. |
Keep in mind these scripts are quick & dirty ! (some parameters are hardcoded, some script do not have error checking at all, etc.)
On the other end, they are fully functionnal, properly written and quite readable. Feel free to tweak the source code. There is always place for code beautifying and optimization. I would appreciate to be informed if you make use of these scripts, but this is not compulsory.
You will find downloads, documentation, howtos, tutorials, books, code snippets, loads of sources and links at http://www.python.org and http://www.python-eggs.org/links.html.