Skip to content

Instantly share code, notes, and snippets.

yhchan

Block or report user

Report or block yhchan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View thread-python-Popen.py
import subprocess
import select
from threading import Thread
from cStringIO import StringIO
def read_stream(stream, output_stream, log_func):
while True:
r, w, x = select.select([stream.fileno()], [], [], 1.0)
if not r:
View requests-benchmark.py
#!/usr/bin/env python
"""
Modifiy from urllib3 benchmark
https://raw.github.com/shazow/urllib3/master/test/benchmark.py
Really simple rudimentary benchmark to compare ConnectionPool versus standard
urllib to demonstrate the usefulness of connection re-using.
"""
from __future__ import print_function
@yhchan
yhchan / thread-subprocess.py
Last active Dec 17, 2015
subprocess with reading stdout and stderr in threads
View thread-subprocess.py
import select
import subprocess
from threading import Thread
from cStringIO import StringIO
import logging
logger = logging.getLogger(__name__)
@yhchan
yhchan / gist:5410941
Created Apr 18, 2013
python defaultdict
View gist:5410941
from collections import defaultdict
class _MissingDictionary(defaultdict):
def __missing__(self, key):
return defaultdict(_MissingDictionary)
configs = defaultdict(_MissingDictionary)
@yhchan
yhchan / gist:1378486
Created Nov 19, 2011
openssl-dev for i586-mingw32
View gist:1378486
$ tar zxvf openssl-1.0.0e.tar.gz
$ cd openssl-1.0.0e/
$ ./Configure --prefix=/usr/i586-mingw32msvc mingw
$ sed -i "s/crypto ssl engines apps test tools/crypto ssl engines/" Makefile
$ make CC=i586-mingw32msvc-gcc RANLIB=i586-mingw32msvc-ranlib
$ sudo make install
@yhchan
yhchan / node-devel-0.3.2.log.1
Created Dec 27, 2010
node-devel-0.3.2.log.1
View node-devel-0.3.2.log.1
===> Building for node-devel-0.3.2
Waf: Entering directory `/usr/ports/www/node-devel/work/node-v0.3.2/build'
[51/73] libv8.a: deps/v8/SConstruct -> build/default/libv8.a
/usr/local/bin/python2.7 "/usr/ports/www/node-devel/work/node-v0.3.2/tools/scons/scons.py" -j 1 -C "/usr/ports/www/node-devel/work/node-v0.3.2/build/default/" -Y "/usr/ports/www/node-devel/work/node-v0.3.2/deps/v8" visibility=default mode=release arch=x64 library=static snapshot=on
scons: Reading SConscript files ...
scons: warning: Ignoring missing SConscript 'obj/test/release/SConscript'
File "/usr/ports/www/node-devel/work/node-v0.3.2/deps/v8/SConstruct", line 1102, in BuildSpecific
scons: done reading SConscript files.
scons: Building targets ...
@yhchan
yhchan / node-devel-0.3.2.log
Created Dec 27, 2010
node-devel-0.3.2.log
View node-devel-0.3.2.log
===> License check disabled, port has not defined LICENSE
=> node-v0.3.2.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch from ftp://ftp.tw.freebsd.org/pub/FreeBSD/distfiles/.
fetch: ftp://ftp.tw.freebsd.org/pub/FreeBSD/distfiles/node-v0.3.2.tar.gz: File unavailable (e.g., file not found, no access)
=> Attempting to fetch from ftp://ftp5.tw.freebsd.org/pub/FreeBSD/ports/distfiles/.
fetch: ftp://ftp5.tw.freebsd.org/pub/FreeBSD/ports/distfiles/node-v0.3.2.tar.gz: File unavailable (e.g., file not found, no access)
=> Attempting to fetch from http://nodejs.org/dist/.
node-v0.3.2.tar.gz 4329 kB 823 kBps
===> Extracting for node-devel-0.3.2
=> SHA256 Checksum OK for node-v0.3.2.tar.gz.
You can’t perform that action at this time.