Skip to content

Instantly share code, notes, and snippets.

import ssl
from socketserver import TCPServer, ThreadingMixIn, StreamRequestHandler
class MySSL_TCPServer(TCPServer):
def __init__(self, server_address, RequestHandlerClass):
TCPServer.__init__(self, server_address, RequestHandlerClass, True)
self.context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
self.context.load_cert_chain(
SELECT EXTRACT(WEEK FROM download_time), python_type, COUNT(*)
FROM (
SELECT python_type, download_time
FROM downloads
WHERE installer_type = 'pip' AND installer_version != ''
) AS d
GROUP BY EXTRACT(WEEK FROM download_time), python_type
ORDER BY EXTRACT(WEEK FROM download_time), python_type, COUNT(*);
{u'able_to_detect_n_minus_one_splitting': False,
u'beast_vuln': False,
u'ephemeral_keys_supported': True,
u'given_cipher_suites': [u'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384',
u'TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384',
u'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384',
u'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384',
u'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA',
u'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA',
u'TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA',
#!/bin/bash
set -x
mkdir -p foo/bar
mkdir -p foo/win
touch foo/bar/PKG-INFO
touch foo/win/a.py
tree foo
#!/Users/dstufft/.pyenv/versions/3.4.0rc3/bin/python3.4
# -*- coding: utf-8 -*-
import re
import sys
from pip import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
# Number 1
def application(environ, start_response):
# forget about start_response right now
return ["body"]
# Number 2
import asyncio
@asyncio.coroutine
def compute(x, y):
driver = Provider(....)
# \/ Only accesses Container.name, which is "container-name"
driver.upload(data, Container("container-name", None, driver), "object-name")
$ rm -rf .testrepository
.testrepository/0
.testrepository/format
.testrepository/next-stream
.testrepository/times.dbm
.testrepository
$ tox -e py26
GLOB sdist-make: /Users/dstufft/projects/barbican/setup.py
py26 inst-nodeps: /Users/dstufft/projects/barbican/.tox/dist/barbican-2014.1.dev1.gdbcc1d9.zip
py26 runtests: PYTHONHASHSEED='547984020'
def foo(thing):
if thing is None:
self._do_thing_none()
else:
self._do_thing(thing)
pip install python-barbicanclient (pip)
Downloading/unpacking python-barbicanclient
Downloading python-barbicanclient-2.1.0.tar.gz (41kB): 41kB downloaded
Storing download in cache at /Users/dstufft/.pip/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fp%2Fpython-barbicanclient%2Fpython-barbicanclient-2.1.0.tar.gz
Running setup.py (path:/Users/dstufft/.virtualenvs/pip/build/python-barbicanclient/setup.py) egg_info for package python-barbicanclient
Traceback (most recent call last):
File "<string>", line 26, in <module>
File "/Users/dstufft/.virtualenvs/pip/build/python-barbicanclient/setup.py", line 23, in <module>
pbr=True,
File "/Users/dstufft/projects/pip/pip/hacks/setuptools.py", line 6, in setup