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
class VLCFileSystem(object): | |
_cur_path = None | |
_cur_dir = None | |
@classmethod | |
def listdir(cls, path): | |
url = 'http://127.0.0.1:8080/requests/browse.json?dir=%s' % path | |
resp = requests.get(url) | |
data = resp.json()['element'] |
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
curl -L -o requests.tar.gz https://github.com/schlamar/requests/archive/new-urllib3-api.tar.gz | |
tar -xzvf requests.tar.gz | |
curl -L -o test_proxy.py https://gist.github.com/schlamar/5080598/raw/test_proxy.py | |
python test_proxy.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
. |
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
import os | |
import re | |
import pyuv | |
LINESEP = os.linesep.encode() | |
PATTERN = re.compile(r'^(?P<file_name>([A-Za-z]:)?[^:]+):' | |
'(?P<line_number>\d+):((?P<position>\d+):)?' | |
'\s+((?P<code>\w{4,4})\s+)?(?P<reason>.*)$') |
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 [1]: %paste | |
import hmac | |
import hashlib | |
import cPickle | |
import cStringIO | |
key = '\xa7\x9ePS\xf5\x84\xce\xc8\xad\xcdfEb\x94\x10K\x9b\x12\xed' | |
dig_size = hashlib.sha1().digest_size | |
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
import sys | |
import gevent | |
from gevent.coros import RLock | |
from gevent.server import StreamServer | |
from gevent.socket import create_connection | |
lock = RLock() | |
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
#!/usr/bin/python | |
import sys | |
import time | |
import math | |
import gtk | |
import gobject | |
import pyglet | |
import pyglet.gl as gl |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
''' | |
This is the modified module `libi18n.locale` from | |
https://www.mail-archive.com/python-list@python.org/msg188668.html. | |
It is fixed to distinguish internationalization and | |
localization. Reference: http://tinyurl.com/gnulocale |
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
System | |
====== | |
Windows 7 | |
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] | |
Small data | |
========== |
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
import httplib | |
import urllib2 | |
import ssl | |
import certifi | |
from backports.ssl_match_hostname import match_hostname | |
class CertValidatingHTTPSConnection(httplib.HTTPConnection): | |
default_port = httplib.HTTPS_PORT |