Skip to content

Instantly share code, notes, and snippets.

yangjuven yangjuven

Block or report user

Report or block yangjuven

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
yangjuven /
Created Nov 8, 2012
test for python cgi.
#!/usr/bin/env python
# -*- coding: utf8 -*-
import os
import sys
import subprocess
environ = {
"QUERY_STRING": "name=juven",
View absolutizeURL.js
function absolutizeURL(url){
var img = document.createElement("img");
img.src = url; // set string url
url = img.src; // get qualified url
img.src = null; // no server request
return url;
yangjuven /
Created Mar 7, 2012
Test gevent.queue in
#!/usr/bin/env python
# -*- coding: utf8 -*-
import web
import gevent
from gevent import queue
from gevent.timeout import Timeout
from gevent.hub import Waiter
from gevent.pywsgi import WSGIServer
from gevent import monkey
yangjuven /
Created Feb 14, 2012
Get md5 of file without getting all content. It's very pythonic
#!/usr/bin/env python
import sys, hashlib
m = hashlib.md5()
with open(sys.argv[1], "rb") as fp:
for chunk in iter(lambda * m.block_size), ""):
yangjuven /
Created Feb 11, 2012
find bottleneck of wsgi service using python cProfile
#!/usr/bin/env python
# -*- coding: gb2312 -*-
# $Id$
import os, sys, cProfile
from wsgi_handler import application
def wsgi():
environ = dict(os.environ.items())
You can’t perform that action at this time.