This file contains hidden or 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 | |
| # | |
| # runnable-pyc | |
| usage_info = \ | |
| """runnable-pyc - make compiled Python code into an executable file | |
| Usage: runnable-pyc <pycfile> [<outputfile>] | |
| If no outputfile is specified, and pycfile ends in '.pyc', then the default |
This file contains hidden or 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 _LevenshteinDistance(str1, i, len1, str2, j, len2, cache): | |
| key = (i, len1, j, len2) | |
| if key in cache: | |
| return cache[key] | |
| if len1 == 0: | |
| return len2 | |
| if len2 == 0: | |
| return len1 |
This file contains hidden or 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 | |
| from twisted.internet import protocol, reactor, endpoints, error | |
| from twisted.application import service | |
| from twisted.python import log | |
| class Forwarder(protocol.Protocol): | |
| def __init__(self): | |
| self.peer = None | |
| self.peer_queue = [] |
This file contains hidden or 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 socket | |
| import contextlib | |
| def choose_unused_port(interface='0.0.0.0', sock_type=socket.SOCK_STREAM): | |
| with contextlib.closing(socket.socket(socket.AF_INET, sock_type)) as s: | |
| s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
| s.bind((interface, 0)) | |
| return s.getsockname()[1] |
This file contains hidden or 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 logging | |
| from twisted.python import log, failure | |
| class TwistedLogHandler(logging.Handler): | |
| """ | |
| Sends Python stdlib logging output through the Twisted logging system. | |
| """ | |
| def __init__(self, twistedlogpublisher=None): |
This file contains hidden or 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 ConfigParser | |
| class SanerConfigParser(ConfigParser.SafeConfigParser): | |
| def __init__(self, defaults=None, dict_type=dict, allow_no_value=False): | |
| ConfigParser.SafeConfigParser.__init__(self, dict_type=dict_type, | |
| allow_no_value=allow_no_value) | |
| self.mydefaults = defaults or {} | |
| no_default = object() |
This file contains hidden or 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 contextlib | |
| import os | |
| import subprocess | |
| import tempfile | |
| class SshTunnelDefinition: | |
| def __init__(self, host, user=None, executable='ssh', localforwards=(), | |
| remoteforwards=(), port=None, options=None): | |
| self.executable = executable |
This file contains hidden or 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
| argparse (all classes) | |
| abc.ABCMeta | |
| collections.Counter | |
| fractions.Fraction | |
| plistlib.Dict and plistlib.Plist | |
| random.Random | |
| unittest.TextTestResult and unittest.FunctionTestCase | |
| weakref.KeyedRef | |
| zipfile.ZipExtFile | |
| ctypes.py_object |
This file contains hidden or 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 signal | |
| def wait_for_subprocs(procs, cb=lambda proc: 0): | |
| # do-nothing handler for SIGCHLD, just so it's something other than SIG_DFL. | |
| # otherwise, Python won't interrupt syscalls. | |
| oldhandler = signal.signal(signal.SIGCHLD, lambda *_: None) | |
| try: | |
| while procs: | |
| signal.pause() | |
| aliveprocs = [] |
This file contains hidden or 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
| diff --git a/tools/dockerz/Dockerfile b/tools/dockerz/Dockerfile | |
| new file mode 100644 | |
| index 0000000..0eafb35 | |
| --- /dev/null | |
| +++ b/tools/dockerz/Dockerfile | |
| @@ -0,0 +1,17 @@ | |
| +FROM ubuntu:trusty | |
| +MAINTAINER <[email protected]> | |
| + | |
| +RUN apt-get -y update \ |