Skip to content

Instantly share code, notes, and snippets.

Donald Stufft dstufft

Block or report user

Report or block dstufft

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 query.sql
SELECT
ROUND(100 * SUM(CASE WHEN REGEXP_EXTRACT(details.installer.version, r"^([^\.]+)") IN ("18", "19") THEN 1 ELSE 0 END) / COUNT(*), 1) AS supports_518,
COUNT(*) as downloads
FROM `the-psf.pypi.downloads*`
WHERE
_TABLE_SUFFIX BETWEEN FORMAT_DATE("%E4Y%m%d", DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY))
AND FORMAT_DATE("%E4Y%m%d", CURRENT_DATE())
AND details.installer.name = 'pip'
AND file.project = 'cryptography'
LIMIT 100
View py3.md
Month Percent Py3
201901 36.2%
201812 36.3%
201811 38.4%
201810 39.7%
201809 36.2%
201808 36.6%
201807 35.5%
201806 34.9%
View emails-for-python-core.py
from github3 import login
gh = login(token="...")
python = gh.organization("python")
for team in python.teams():
if team.slug == "python-core":
core_developers = team
break
View retrywtf.py
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid_retry import RetryableException, IBeforeRetry
def on_before_retry(event):
print("A Retry!")
def hello_world(request):
View build.sh
# Prime the Cache
$ time python setup.py build --build-base ~v/tmp-ec63b471f919101/cache/
...
python setup.py build --build-base ~v/tmp-ec63b471f919101/cache/ 76.24s user 4.16s system 96% cpu 1:23.33 total
# Test in place rebuilds
$ time python setup.py build --build-base ~v/tmp-ec63b471f919101/cache/
...
python setup.py build --build-base ~v/tmp-ec63b471f919101/cache/ 0.81s user 0.27s system 84% cpu 1.265 total
View main.tf
# US-East-1 Has 5 availability zones, and we want to split our network over all
# of them. So we will do a /19 per AZ which will give us the ability to expand
# up to 8 total AZs or to add more capacity in 3/5 of the other AZs if need be.
# If for some reason this is being run in a region with less AZs, we will just
# have more left over capacity being reserved as a spare. In addition, we will
# split our allocation within each AZ up into a /20 for all of our private
# instances, a /21 for all of our public instances, and a /21 left over for
# spare capacity. This will give us the largest block of IP addresses for our
# private tier, where most of our instances will reside, while still leaving
# spare allocation for the future.
View etc_cron.daily_letsencrypt
#!/bin/bash
set -e
DOMAINS=""
while read d; do
DOMAINS="$DOMAINS -d $d"
done < /etc/letsencrypt/domains
letsencrypt certonly \
-n --agree-tos --email donald@stufft.io --webroot -w /var/www/letsencrypt \
View first.toml
[package]
name = "Pyramid"
[package.build-system]
tool = "whatever"
requires = ["setuptools", "wheel"]
[package.test-system]
command = "py.test"
requires = ["pytest", "pytest-timeout"]
View pyproject.toml
[package]
name = "Django"
# version = ... # This is omitted, ``setup.py`` must be executed to read it.
summary = """
A high-level Python Web framework that encourages rapid development and\
clean, pragmatic design.\
"""
url = "http://www.djangoproject.com/"
author = "Django Software Foundation"
author-email = "foundation@djangoproject.com"
View conftest.py
def pytest_addoption(parser):
parser.addoption(
"--backend", action="store", metavar="NAME",
help="Only run tests matching the backend NAME."
)
You can’t perform that action at this time.