Skip to content

Instantly share code, notes, and snippets.

View alex's full-sized avatar

Alex Gaynor alex

View GitHub Profile
(439376f7590a7969)Alexanders-MacBook-Pro:tmp alex_gaynor$ python jsonbench.py
Benchmark Report
================
BenchmarkContainerListingGeneration
-----------------------------------
name | rank | runs | mean | sd | timesBaseline
-----------|------|------|------------|-------------|--------------
MAX_AGE = datetime.timedelta(days=32)
HOUR = "hour"
DAILY = "daily"
PRECISIONS = [
(HOUR, "%y-%m-%d-%H"),
(DAILY, "%y-%m-%d"),
]
class BlockStorageBaseDriver(object):
def list_volumes(self):
"""
Returns a list of ``Volume`` objects.
"""
def create_volume(self, size, name=None):
"""
Creates a new volume that is ``size`` GB large. Returns a ``Volume``.
"""
class BlockStorageBaseDriver(object):
def list_volumes(self):
"""
Returns a list of ``Volume`` objects.
"""
def create_volume(self, size, name=None):
"""
Creates a new volume that is ``size`` GB large. Returns a ``Volume``.
"""

Guide to how fucked is SSL?

Thanks to Jacob Kaplan-Moss, Donald Stufft, David Reid, Allen Short, Zain Memon, and Chris Armstrong for review.

This is a guide for technical individuals to understand in what circumstances SSL communications are secure against an observer-in-the-middle (for all intents and purposes: the NSA).

Guide to how fucked is SSL?
===========================
This is a guide for technical individuals to understand in what circumstances
SSL communications are secure against an observer-in-the-middle (for all
intents and purposes: the NSA).
How does SSL work?
------------------
@alex
alex / gist:5664808
Last active December 17, 2015 19:59

Design for app-level loop unrolling in PyPy

Purpose

Right now, code that is sufficiently meta-programmy often generates very suboptimal code for the JIT. A common example is a function which takes (*args) and then performs an operation over each of them. In cases like this, usually the caller has a fixed argument count, but the implementation

@alex
alex / gist:5606580
Last active December 17, 2015 11:59
The number of pages that get scraped whenever you install each of these packages from PyPi. If the number is greater than 1 for a package you own you should go into the PyPi admin for your package, go to the "URLs" page, select "Do not extract URLs…", then remove all the URLs below. These represent the top 60 packages on PyPi.
(148118dc63005126)alex@alex-gaynor-laptop:~/.virtualenvs/148118dc63005126$ python pypi_show_urls.py lxml distribute boto zc.buildout pip simplejson pytz requests Paste Django virtualenv Jinja2 PasteDeploy nose psycopg2 pymongo coverage python-dateutil SQLAlchemy Pygments httplib2 pycrypto PasteScript zope.interface Werkzeug Flask Fabric kombu MySQL-python aspen South paramiko celery greenlet anyjson gunicorn six WebOb graphite-web supervisor Sphinx Mako setuptools-git suds selenium carbon mock PyYAML MarkupSafe unittest2 Markdown msgpack-python Deliverance redis docutils gevent numpy ipython SQLObject amqplib Beaker
lxml: 2
distribute: 2
boto: 1
zc.buildout: 2
pip: 1
simplejson: 3
pytz: 4
requests: 1
Paste: 2
import sys
import tempfile
import webbrowser
import pygments
import pygments.formatters
import pygments.lexers
import pygments.styles

PyPy Advocacy

  • Better cffi docs.
  • PyPy Py3k
  • A better database of library compatibility
  • Case studies
  • Documentation on using in production.