View brew --config && brew doctor
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
$ brew --config | |
HOMEBREW_VERSION: 0.9.4 | |
ORIGIN: https://github.com/mxcl/homebrew.git | |
HEAD: d0a2ed907ddb750c519bb9f56d7055490f968edf | |
HOMEBREW_PREFIX: /usr/local/homebrew | |
HOMEBREW_CELLAR: /usr/local/homebrew/Cellar | |
CPU: 8-core 64-bit ivybridge | |
OS X: 10.8.3-x86_64 | |
Xcode: 4.6.1 | |
CLT: 4.6.0.0.1.1362189000 |
View xmlhelp.py
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
''' xml utilities ''' | |
__author__ = 'jin@recessnetworks.net' | |
from itertools import groupby | |
from operator import attrgetter | |
def split_ns(txt): | |
''' returns [ns, tag] for '{ns}tag' | |
>>> split_ns('{http://www.w3.org/2001/XMLSchema-instance}nil') |
View ZSI.wstools.Utility.py
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
# in class TimeoutHTTPS: | |
def connect(self): | |
sock = TimeoutSocket(self.timeout) | |
sock.connect((self.host, self.port)) | |
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file) |
View randomize iterator in python
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
from random import shuffle, randrange | |
def randomize(iterable, bufsize=1000): | |
''' generator that randomizes an iterable. space: O(bufsize). time: O(n). ''' | |
buf = list() | |
for x in iterable: | |
if len(buf) == bufsize: | |
i = randrange(bufsize) | |
yield buf[i] | |
buf[i] = x |