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
# copied from https://github.com/django-guardian/django-guardian/blob/devel/benchmarks/run_benchmarks.py | |
#!/usr/bin/env python | |
""" | |
This benchmark package should be treated as work-in-progress, not a production | |
ready benchmarking solution for django-guardian. | |
""" | |
import datetime | |
import os | |
import random |
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 -*- | |
import curses, traceback, string | |
#-- Define the appearance of some interface elements | |
hotkey_attr = curses.A_BOLD | curses.A_UNDERLINE | |
menu_attr = curses.A_NORMAL | |
#-- Define additional constants |
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_open_port(): | |
import socket | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.bind(("",0)) | |
s.listen(1) | |
port = s.getsockname()[1] | |
s.close() | |
return port |
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
# install custom sqlite 3.14 | |
wget https://github.com/ghaering/pysqlite/archive/2.8.3.tar.gz | |
wget https://www.sqlite.org/2016/sqlite-autoconf-3140100.tar.gz | |
tar -xzvf sqlite-autoconf-3140100.tar.gz | |
tar -xzvf 2.8.3.tar.gz | |
cp -av sqlite-autoconf-3140100/. pysqlite-2.8.3/ | |
cd ./pysqlite-2.8.3 && python setup.py build_static install |
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 elementwise(fn): | |
def newfn(arg): | |
if hasattr(arg,'__getitem__'): # is a Sequence | |
return type(arg)(map(fn, arg)) | |
else: | |
return fn(arg) | |
return newfn | |
@elementwise | |
def compute(x): |
NewerOlder