Skip to content

Instantly share code, notes, and snippets.

Zapier is hiring!

Bryan Helmig bryanhelmig

Zapier is hiring!
View GitHub Profile
View immer-patches.js
var immer = require("immer");
var produce = immer.produce;
var patches = [];
var state0 = { a: 1 };
var state1 = produce(
function (draft) {
draft.b = 9;
bryanhelmig /
Created Dec 26, 2017
Compare pip freeze to requirements.txt for use in a bash script where pip may not be installed.
#!/usr/bin/env python
import argparse
import subprocess
import sys
from packaging.version import parse as parse_version
def parse_dependencies(text):
bryanhelmig /
Created Sep 11, 2017
a zapier python lint command, put it on path!
#!/usr/bin/env bash
CHANGED_PYTHON_FILES=`git diff-tree --diff-filter=ACMRT --no-commit-id --name-only -r origin/develop.. -- "*.py" | tr "\n" " "`
flake8 --exit-zero --format=pylint ${CHANGED_PYTHON_FILES}
pylint --py3k --disable=no-absolute-import --disable=round-builtin -sn --msg-template="{path}:{line}: [{msg_id}] {msg}" ${CHANGED_PYTHON_FILES}
bryanhelmig /
Created Mar 23, 2017
A script that watches prime now for stock, sending a webhook to Zapier which you can configure to send you an SMS, Slack, whatever...
import time
import bs4
import requests
import logging
import sys
logger = logging.getLogger('switchlogger')
ch = logging.StreamHandler(sys.stdout)

Keybase proof

I hereby claim:

  • I am bryanhelmig on github.
  • I am bryanhelmig ( on keybase.
  • I have a public key whose fingerprint is BC07 78B9 D1A4 3DBA DF36 F565 4429 102A 84CB 847F

To claim this, I am signing this object:

View decorator.go
package main
import (
func decorator(f func(s string)) func(s string) {
return func(s string) {
bryanhelmig /
Last active Feb 8, 2017
Counts of users' events by day
users if active or not on a given day plus counts of events
import os
import csv
from collections import defaultdict
from collections import Counter
UFILE = 'data/users.csv'
bryanhelmig /
Last active Nov 4, 2016
A short snippet of Python that detects keyboard mashing like dsuyafgsgafiuyas.
import itertools
import math
def tokenize_keyboard(board):
return [list(row.strip()) for row in board]
def invert_grid(grid):
out = {}
for row_i, row in enumerate(grid):
for col_i, cell in enumerate(row):
bryanhelmig /
Created Jul 15, 2016 — forked from caiguanhao/
Recursively crush/shrink/optimize/losslessly compress PNGs, JPEGs and GIFs.
# This is modifed from
# This is an improved script of (
# which can also crush/shrink/optimize/losslessly compress JPEGs and GIFs.
# It is recommended you backup your image files before executing this script.
# Operation will be skipped if output file is bigger in size.
# use chmod +x to make it executable and then ./ to run, or
# bash ./ to run it directly
View food.json
"id": 6,
"name": "banana"
"id": 5,
"name": "burrito"