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 get_revision(path=None): | |
""" | |
Return the revision identifier of the last commit in a git or svn source pool. | |
""" | |
if path is None: | |
path = "." | |
import os, re, subprocess | |
revision = None | |
os.chdir(path) |
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
context = { | |
'database': { | |
'port': 9990, | |
'users': ['number2', 'dr_evil'] | |
}, | |
'admins': ['[email protected]', '[email protected]'], | |
'domain.name': 'virtucon.com' | |
} | |
# Most comprehensive solution by http://stackoverflow.com/users/95810/alex-martelli |
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
#!/bin/sh - | |
if [ $# -ne 1 ]; then | |
PATHDIR=`pwd` | |
else | |
PATHDIR=$1 | |
fi | |
/usr/bin/osascript > /dev/null <<-EOF | |
activate application "Terminal" |
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
import random | |
import socket | |
# range of ports where available ports can be found | |
PORT_RANGE = [33000,60000] | |
def find_unbound_port(): | |
""" | |
Returns an unbound port number on 127.0.0.1. | |
""" |
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
import os | |
import re | |
def increpl(matchobj): | |
""" | |
Replace the include statement with the contnet of the file. | |
""" | |
inc = matchobj.group(1) | |
return parse(inc) |
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
import csv | |
from xlrd import open_workbook | |
def excel_to_csv(excel_file, include=None): | |
""" | |
Convert the data in the excel_file to CSV. If | |
include is specified, only those named columns | |
will be included in the CSV. | |
""" |
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
import pathfinder | |
# only search top 2 levels of the directory tree | |
paths = pathfinder.pathfind(".", depth=2) |
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
#!/bin/bash | |
watchmedo shell-command --patterns="*.less" --command=\ | |
'LESS=`echo "${watch_src_path}" | sed s/.less/.css/`; \ | |
echo compile: "${watch_src_path}";\ | |
lessc "${watch_src_path}" "${LESS}"; \ | |
if [ "$?" -eq "0" ]; then echo wrote: "${LESS}"; fi' $* |
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
(python2.7)django-exceptional $ pip install --upgrade django-exceptional | |
Downloading/unpacking django-exceptional | |
Downloading django-exceptional-0.1.5.tar.gz | |
Running setup.py egg_info for package django-exceptional | |
Installing collected packages: django-exceptional | |
Running setup.py install for django-exceptional | |
Successfully installed django-exceptional | |
Cleaning up... |
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
/*** tough-cookie/lib/cookie.js ***/ | |
/* I added the following to the end of the file for testing purposes */ | |
memstore = require('./memstore'); | |
module.exports.memorystore = memstore.MemoryCookieStore; | |
/*** jsonstore.js ***/ | |
var tough = require('tough-cookie'); | |
// ... |
OlderNewer