Skip to content

Instantly share code, notes, and snippets.

View brew --config && brew doctor
$ 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
@razamatan
razamatan / xmlhelp.py
Created March 10, 2011 01:26
simple conversion from etree parsed xml to objects
View xmlhelp.py
''' 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')
@razamatan
razamatan / ZSI.wstools.Utility.py
Created February 8, 2011 22:43
fix for ZSI 2.0 and python 2.6's ssl handling
View ZSI.wstools.Utility.py
# 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)
@razamatan
razamatan / randomize iterator in python
Created December 10, 2010 10:10
randomize python iterator
View randomize iterator in python
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