Skip to content

Instantly share code, notes, and snippets.

View bryanhelmig's full-sized avatar
Zapier is hiring!

Bryan Helmig bryanhelmig

Zapier is hiring!
View GitHub Profile
import random
start = 0.05
end = 0.2
interval = 11
intervals = [0.0] * interval
step = (end - start) / (interval * 2) # adjust to taste, coarser might feel more "random"
# only continue while the gap between start and end isn't closed
@bryanhelmig
bryanhelmig / setup-statsd.sh
Created August 10, 2012 00:10 — forked from rw/setup-statsd.sh
Turn an Ubuntu 11.10 EC2 into a StatsD/Graphite server
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
sudo apt-get install nodejs
# install the Node package manager for later use
curl http://npmjs.org/install.sh | sudo sh
sudo npm install express
# clone the statsd project
git clone https://github.com/etsy/statsd.git
# download everything for graphite
class AnnotateManager(models.Manager):
def get_query_set(self):
return super(AnnotateManager, self).get_query_set()\
.extra(select={'has_prefill': 'ISNULL(prefill)'})\
.order_by('-has_prefill', '-required', 'id')
"limits": {
"zap_limit": -1,
"action_limit": -1,
"actions_this_period": 4,
"app_blacklist_list": [],
"allotment": [
{
"count": 1,
"percent": 0,
"limit": "unlimited",
traceroute: Warning: d2glos6gx2bw40.cloudfront.net has multiple addresses; using 205.251.215.209
traceroute to d2glos6gx2bw40.cloudfront.net (205.251.215.209), 64 hops max, 52 byte packets
1 unknown (192.168.1.1) 0.481 ms 0.399 ms 0.348 ms
2 71.204.164.1 (71.204.164.1) 96.459 ms 29.902 ms 19.931 ms
3 te-0-1-0-4-ur05.santaclara.ca.sfba.comcast.net (68.86.248.17) 10.354 ms 8.242 ms 9.542 ms
4 te-1-1-0-3-ar01.sfsutro.ca.sfba.comcast.net (68.85.155.62) 22.286 ms
te-1-1-0-2-ar01.sfsutro.ca.sfba.comcast.net (68.85.155.58) 9.923 ms
te-1-1-0-1-ar01.sfsutro.ca.sfba.comcast.net (69.139.198.90) 22.058 ms
5 he-1-6-0-0-cr01.sanjose.ca.ibone.comcast.net (68.86.90.157) 15.108 ms 18.198 ms 12.607 ms
6 xe-11-0-0.edge1.sanjose1.level3.net (4.79.43.137) 26.000 ms 26.451 ms 27.229 ms
results = JSON.parse(bundle.response.content);
// assuming results is an array of objects, object being the full json you pasted
out = _.map(results, function(result){
// handle properties, ignoring versions
result.properties = _.object(_.map(result.properties, function(valueSet, key){
return [key, valueSet.value];
}));
// similar code to handle examples of {key: Array()}, maybe using _.first?
return result;
{
"name": "My Fancy Zap Title",
"link": "https://zapier.com/app/edit/12345",
"trigger": {
"service": {
"name": "Service Name (like Github)",
"logos": {
"16x16": "https://cdn.zapier.com/path/to/image.16x16.png",
"32x32": "https://cdn.zapier.com/path/to/image.32x32.png",
"64x64": "https://cdn.zapier.com/path/to/image.64x64.png"
@bryanhelmig
bryanhelmig / middleware.py
Last active August 29, 2015 14:02
Skip sessions and user authentication middleware in Django (1.4).
from django.conf import settings
from django.core.handlers.base import BaseHandler
from django.core import urlresolvers
SILENT_EARLY_RETURN_FAIL = getattr(settings, 'SILENT_EARLY_RETURN_FAIL', True)
def return_early_decorator(view):
"""
In a view, return early, like so:

hi

foreverasdasdasd

#! /usr/bin/perl
# Written by Dormando.
# PUBLIC DOMAIN.
# No guarantees it won't eat your cat.
use warnings;
use strict;
use IO::Socket::INET;
use Time::HiRes qw/time sleep/;