This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
This sample script is an example use of the threading pool to process a | |
sequence of items. | |
This is both python2 and python3 compatible. | |
""" | |
from __future__ import print_function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
# coding: utf-8 | |
''' | |
This script shows an example of rotating log files in a directory. | |
''' | |
# Imports ##################################################################### | |
import os | |
import sys | |
import tarfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
r''' | |
This script converts a vCard file to a Dymo ABX address book. | |
Usage: | |
vcf2abx <input VCF file> <output ABX file> | |
Example: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
''' | |
This script shows an example of using `requests` and the USPS Address | |
Information API. | |
In order to use this, you must first register so you can get your USERID. Your | |
ID must be in the environment variable `USPS_USERID`. | |
For information on the API see here: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
""" | |
This script is used to convert a WordPress XML dump to Hugo-formatted posts. | |
NOTE: The WP post data is kept as-is (probably HTML). It is not converted to | |
Markdown. This is to reduce the amount of "fixing" one has to do after the | |
data is converted (e.g. line endings, links, etc). This is generally not an | |
issue since Markdown allows HTML. | |
The post Metadata is converted to TOML. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sendmail(subject, to, sender, body, mailserver, body_type="html", attachments=None, cc=None): | |
"""Send an email message using the specified mail server using Python's | |
standard `smtplib` library and some extras (e.g. attachments). | |
NOTE: This function has no authentication. It was written for a mail server | |
that already does sender/recipient validation. | |
WARNING: This is a non-streaming message system. You should not send large | |
files with this function! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import re | |
import urllib | |
import urllib2 | |
class Spreadsheet(object): | |
def __init__(self, key): | |
super(Spreadsheet, self).__init__() |
NewerOlder