Posts

Showing posts from November, 2010

PyMOTW: hmac - O'Reilly ONLamp Blog

PyMOTW: hmac - O'Reilly ONLamp Blog : "import hmac import hashlib digest_maker = hmac.new('secret-shared-key-goes-here', '', hashlib.sha1) f = open('hmac_sha.py', 'rb') try: while True: block = f.read(1024) if not block: break digest_maker.update(block) finally: f.close() digest = digest_maker.hexdigest() print digest - Sent using Google Toolbar"

WorkingWithTime - PythonInfo Wiki

WorkingWithTime - PythonInfo Wiki : "Working with Time Notably missing from this page are the capabilities of the Python datetime module, which was introduced in 2.3 and is very powerful. This page gives some basics of working with time in Python. More detail can be found in the time Module Documentation. Formats There are several ways to work with time: format Python seconds since the 'Epoch' time.time() tuple time.gmtime() string time.ctime() The Epoch is January 1st, 1970, midnight, on UNIX systems. On other systems, look at the results of time.gmtime(0) to discover the date of the Epoch. Measuring time in seconds since the Epoch is convenient for storage and comparing dates, because you only have a single number to consider. The tuple contains several values, arranged the following way: year, month 1-12, day 1-31, hour 0-23, minutes 0-59, seconds 0-61, day 0-6 (Mon-Sun), day 1-366, and DST -1,0,+1. 'DST' means 'daylight savings time.' For more infor...

1.2 Installing ZenPacks - Open Source Network Monitoring and Systems Management

1.2 Installing ZenPacks - Open Source Network Monitoring and Systems Management : "#2. Installing ZenPacks ZenPacks are distributed as .egg files. Zenoss also supports .zip files. You can install ZenPacks from the command line on the Zenoss server, or from the Zenoss user interface. #2.1. Installing from the Command Line The following ZenPack command can be used from the command line to install ZenPack files. After installing or updating ZenPacks you need to restart Zenoss: zenpack --install zenoss restart If you have the source code for the ZenPack you can install directly from that rather than from a .egg or .zip file. The command is the same, you just specify the directory containing the source code. This copies the source code into either $ZENHOME/ZenPacks (for newer egg ZenPacks) or $ZENHOME/Products (for older style ZenPacks.) zenpack --install zenoss restart If you are developing a ZenPack you usually will want to maintain your source code outside of $ZENHOME/ZenPacks or $Z...

TurboGears "offline" processes (crons, command-line commands, etc) - Plumbing Life's Depths

TurboGears "offline" processes (crons, command-line commands, etc) - Plumbing Life's Depths : "TurboGears 'offline' processes (crons, command-line commands, etc) TurboGears uses the Paste commands system to create command-line entry points that, for example, set up your database or start your server. When you get to larger projects, however, you will often have other things you need to do 'in the context of your application' from the command line, such as periodic imports of data, or cron'd database management tasks. Paste's command system is well documented, but it can take quite a bit of poking around to find out how to get SQLAlchemy, and TurboGears configured so that code that looks in tg.config gets the right values, and SQLAlchemy has access to your models. This little module (tgcommand.py) is my hacked-together attempt to make it easier to create new TG command-line commands. The idea is that for each application you will create a Bas...

How to setup Client Scripting in OpenVPN Access Server

How to setup Client Scripting in OpenVPN Access Server : "How to setup Client Scripting in OpenVPN Access Server Sample Python Scripts --------------------- Launch a URL: #!/usr/bin/env python # On VPN connection initiation, launch a URL in the default browser. # Works on all client platforms (Windows, Mac, Linux). # Environmental Variables: # LAUNCH_URL -- URL to launch import os, webbrowser if os.environ['N_RECONNECTS'] == '0': webbrowser.open_new(os.environ['LAUNCH_URL']) Download and install an application on Windows: #!/usr/bin/env python # Download and install an MSI-based application on Windows. Leave a marker # file behind, so that we only install the application once per local user. # Environmental Variables: # MSI_URL -- URL of MSI file # MSI_HASH -- sha1 hash of MSI file, for security verification # MSI_OPT (optional) -- extra MSI arguments, such as /q for quiet install import os, urllib, scripthelper as sh url = os.environ['MSI_...

You incorrectly receive an error message when you join a computer that is running Windows 7 or Windows Server 2008 R2 to a Samba 3-based domain

You incorrectly receive an error message when you join a computer that is running Windows 7 or Windows Server 2008 R2 to a Samba 3-based domain : "You incorrectly receive an error message when you join a computer that is running Windows 7 or Windows Server 2008 R2 to a Samba 3-based domain - Sent using Google Toolbar"

Custom Filters - Zimbra :: Forums

Custom Filters - Zimbra :: Forums : "sieve - you can even convert from procmail:/forums/users/7239-any-way-add-message-filters-command-line.html very simply it's kinda like: zmprov modifyAccount user@domain.com zimbraMailSieveScript 'require ['fileinto', 'reject', 'tag', 'flag'] or there's always: zmmailbox -z -m user@domain.com addFilterRule 'tag special' active any header 'subject' contains 'special' tag 'special' stop -this should also add it into the user's list of rules to manage from the web interface - Sent using Google Toolbar"

SQLite Frequently Asked Questions

SQLite Frequently Asked Questions : "(11) How do I add or delete columns from an existing table in SQLite. SQLite has limited ALTER TABLE support that you can use to add a column to the end of a table or to change the name of a table. If you want to make more complex changes in the structure of a table, you will have to recreate the table. You can save existing data to a temporary table, drop the old table, create the new table, then copy the data back in from the temporary table. For example, suppose you have a table named 't1' with columns names 'a', 'b', and 'c' and that you want to delete column 'c' from this table. The following steps illustrate how this could be done: BEGIN TRANSACTION; CREATE TEMPORARY TABLE t1_backup(a,b); INSERT INTO t1_backup SELECT a,b FROM t1; DROP TABLE t1; CREATE TABLE t1(a,b); INSERT INTO t1 SELECT a,b FROM t1_backup; DROP TABLE t1_backup; COMMIT; -...

How-to: Convert mysql to sqlite | JBipNet

How-to: Convert mysql to sqlite | JBipNet : "--compatible=ansi --skip-opt generator > dumpfile - Sent using Google Toolbar"