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 | |
""" | |
Usage: | |
add this to your setup.py: | |
... | |
cmdclass={'bundle': BundleInstall}, | |
... | |
Will add a bundle setup.py command that create a bundle archive in dist directory by running |
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 | |
from nltk.corpus import verbnet | |
import sys | |
class CommitException(Exception): | |
def __init__(self, msg, line, start, end, fatal=False): | |
Exception.__init__(self,msg) | |
self._line = line | |
self._start = start |
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 re | |
wkt_regex = re.compile(r'^(SRID=(?P<srid>\-?\d+);)?' | |
r'(?P<wkt>' | |
r'(?P<type>POINT|LINESTRING|LINEARRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION)' | |
r'[ACEGIMLONPSRUTYZ\d,\.\-\(\) ]+)$', | |
re.I) | |
with open('test.wkt', 'r') as fd: | |
wkt=fd.read().strip('\n').strip(' ') |
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 | |
_init=lambda: "This is my value (%i)" % random.randrange(0, 100) | |
_my=_init() | |
get=lambda: _my | |
if __name__ == "__main__": # A minimal test. | |
myvalue=get() | |
for _ in xrange(0, 100): assert(get() == myvalue) |
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 | |
import sys | |
import fnmatch | |
import logging | |
import subprocess | |
def Logger(): | |
return logging.getLogger("post-recieve-hook") | |
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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#ifdef HAVE_AV_CONFIG_H | |
#undef HAVE_AV_CONFIG_H | |
#endif | |
#include "libavcodec/avcodec.h" |
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 urllib2 | |
def fetch_page(url): | |
opener = urllib2.build_opener() | |
request = urllib2.Request(url) | |
datafd = opener.open(request) | |
return datafd.read() |
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 | |
import os, sys, re, cookielib, urllib2, random, logging | |
import datetime | |
import urllib | |
import time | |
import socket | |
from BeautifulSoup import BeautifulSoup | |
from threading import Thread | |
MEGAREGEX = '.*megavideo\.com.*v=([A-Za-z0-9]+).*' | |
DEBRIDREGEX = '.*(http://.+key=[a-z0-9-A-Z]+).*' |
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 urllib2 | |
class BigFileDownloader(object): | |
def __init__(self, url, file): | |
self.packet_size = 128 | |
self.urlopener = urllib2.build_opener() | |
self.url = url | |
self.file = file |
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 | |
import sys | |
import urllib2 | |
import datetime | |
import time | |
import socket | |
import logging | |
from threading import Thread | |
socket.setdefaulttimeout(10000) |
NewerOlder