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 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 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
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
#!/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
--- /usr/bin/git-pbuilder 2012-09-28 12:18:15.000000000 -0600 | |
+++ /usr/bin/fixed-git-pbuilder 2012-11-08 21:07:37.123999784 -0700 | |
@@ -1,4 +1,4 @@ | |
-#!/bin/sh | |
+#!/bin/bash | |
# $Id: git-pbuilder,v 1.27 2012/01/13 04:12:35 eagle Exp $ | |
# | |
# git-pbuilder -- Wrapper around pbuilder for git-buildpackage | |
@@ -75,7 +75,8 @@ | |
fi |
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
This file contains any messages produced by compilers while | |
running configure, to aid debugging if configure makes a mistake. | |
It was created by quvi configure 0.2.19, which was | |
generated by GNU Autoconf 2.68. Invocation command line was | |
$ ./configure --disable-dependency-tracking --prefix=/usr/local/Cellar/quvi/0.2.19 --enable-nsfw --enable-todo --enable-nlfy | |
## --------- ## | |
## Platform. ## |
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 solve_knapsack(items, maxcost, cost=lambda n:n, value=None): | |
""" | |
Generic dynamic-programming knapsack problem solver. Takes time | |
O(len(items) * maxcost), so it can be helpful to reduce the costs | |
and maxcost by the greatest common divisor if possible. Costs for | |
all items must be nonnegative integers. | |
Returns the set of items the sum of whose costs does not exceed | |
maxcost, and the sum of whose values is otherwise maximal. | |
""" |
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 collections | |
import Queue | |
class MaxSizeDict(collections.MutableMapping): | |
def __init__(self, maxsize): | |
self.maxsize = maxsize | |
self.valdict = {} | |
self.keyqueue = Queue.Queue() | |
def __setitem__(self, key, value): |
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/Library/Formula/nmap.rb b/Library/Formula/nmap.rb | |
index 8bd1df1..7e06901 100644 | |
--- a/Library/Formula/nmap.rb | |
+++ b/Library/Formula/nmap.rb | |
@@ -14,7 +14,7 @@ class Nmap < Formula | |
def install | |
ENV.deparallelize | |
- args = ["--prefix=#{prefix}", "--without-zenmap"] | |
+ args = ["--prefix=#{prefix}", "--without-zenmap", "--without-liblua", "CFLAGS=-DNOLUA"] |