Skip to content

Instantly share code, notes, and snippets.

View ipmb's full-sized avatar

Peter Baumgartner ipmb

View GitHub Profile
#!/usr/bin/env python
import datetime
import fnmatch
from functools import partial
import gzip
import json
import os
import shutil
import socket
@ipmb
ipmb / Dockerfile
Created May 24, 2015 21:23
Example wheel upload to simple PyPI on S3
FROM ubuntu:14.04
ENV BUCKET your-s3-bucket
RUN apt-get update && apt-get install -y wget \
build-essential python-dev \
libssl-dev libffi-dev \
libpcre3-dev \
libmemcached-dev \
libpq-dev \
#!/usr/bin/env python
import socket
import time
import psutil
PREFIX = [
'server',
socket.getfqdn().replace('.', '_'),
]
FROM centos:7
ENV VERSION versions/0.9
ENV GO_VERSION 1.4.2
ENV CMAKE_VERSION 3.2.3
ENV PATH=/go/bin:$PATH
ENV GOROOT=/go
RUN yum install -y git gcc make rpmdevtools mercurial
RUN curl -sO https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz && \
@ipmb
ipmb / _double_your_requests.md
Last active August 29, 2015 14:24
How to Double your Traffic with JavaScript

Making an HTTP request to undefined is the equivalent of requesting the same page again ('.' or window.location.href). The examples below were found in three out of three front-end performance audits we performed for clients at Lincoln Loop over the last two weeks.

@ipmb
ipmb / text.md
Created August 21, 2015 22:27
PyPy vs. CPython comparison

Test machine: OS X 10.10.5 w/ 2.4 GHz Intel Core i5

Server:

$ gunicorn -w2 botbot.wsgi:application

Client:

#!/bin/bash
PYPYVENV="~/db-pypy"
CPYVENV="~/db-cpy"
virtualenv --python=`which pypy` $PYPYVENV
virtualenv $CPYVENV
$PYPYVENV/bin/pip install -e git://github.com/django/djangobench.git#egg=djangobench
$CPYVENV/bin/pip install -e git://github.com/django/djangobench.git#egg=djangobench
@ipmb
ipmb / gist:e65159f7315b9645841b
Last active January 7, 2016 19:09
Django migrations cprofile
$ manage.py showmigrations | grep "\[" | wc -l
85
$ echo "\d" | psql mydb | grep -v sequence | wc -l
299
$ time python -m cProfile -s time ./manage.py makemigrations --empty pages
Migrations for 'pages':
0014_auto_20160107_1356.py:
108764127 function calls (108404501 primitive calls) in 264.744 seconds
Ordered by: internal time
@ipmb
ipmb / gist:75be883defe09fc3dc32
Created January 7, 2016 20:21
Django 1.9.1 makemigrations
$ python -m cProfile -s time ./manage.py makemigrations --empty pages
Migrations for 'pages':
0014_auto_20160107_1519.py:
66325365 function calls (65778093 primitive calls) in 157.981 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
306135 10.721 0.000 16.741 0.000 __init__.py:139(__init__)
203638 8.801 0.000 14.381 0.000 __init__.py:370(deconstruct)