Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

David Cramer dcramer

I may be slow to respond.
Block or report user

Report or block dcramer

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 gist:5768820
txagent (python module)
resources/ (various things, like upstart conf)
Need to:
- install txagent into python site-packages (taken care of)
- put resource data files in arbitrary place or something (they're not required by txagent itself)
View gist:5753418
Traceback (most recent call last):
File "/usr/lib/python2.7/", line 552, in __bootstrap_inner
File "/var/lib/jenkins/workspace/tests-and-coverage/env/lib/python2.7/site-packages/paramiko/", line 116, in run
File "/var/lib/jenkins/workspace/tests-and-coverage/env/lib/python2.7/site-packages/paramiko/", line 126, in _communicate
events = select([self._agent._conn, self.__inr], [], [], 0.5)
TypeError: argument must be an int, or have a fileno() method.
View gist:5703297
class ConfigurationView(BaseView):
def get_conf_key(self):
raise NotImplementedError
def get_form_class(self, request):
raise NotImplementedError
def render(self, request, template, context=None, **kwargs):
from sentry.web.helpers import render_to_response
View gist:5682052
from datetime import timedelta
from celery.task import periodic_task, task
from celery.task.schedules import crontab
from django.utils import timezone
from sentry.constants import MINUTE_NORMALIZATION
from sentry.utils import math
def fsteps(start, stop, steps):
View gist:5625467
import inspect
import time
from django_statsd.clients import statsd
from django.http import Http404
class GraphiteResponseCodeMiddleware(object):
def process_response(self, request, response):
View gist:5617510
Get a key:
>>> key = Key.objects.get_or_create(
>>> name='{}'.format(group_id)
>>> )
View gist:5556161
cursor = (shard 0, id 0, group id 0)
> get 10k items from shard 0
> group id set to max(id of results), say 20000
> get 10k items from shard 1 < group id (20000)
> adjust id if we hit 10k+ items, and repeat on same shard
> once group id is hit, go to next shard, and repeat same logic used on shard 1
> once last shard is done, go back to shard 0, get the next 10k results, and reset group id
View gist:5551125
-e git+
View gist:5537828
- 2 runs, one warmup, one timed
- warmup was 5m
- timed run 30s
- default sentry settings (no database access)
- 3 sync workers
- sentry start
- os-x (brew install pypy --devel)
- siege -c 3 http://localhost:9000/login/ -b -t30S
== pypy 2.0 beta 2
View gist:5537782
# pypy
100 requests serviced in 17.763s
avg of 0.178s/req, 5 req/s
real 0m27.111s
user 0m22.705s
sys 0m0.646s
# python2.7
You can’t perform that action at this time.