Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jcushman on github.
  • I am jcushman (https://keybase.io/jcushman) on keybase.
  • I have a public key whose fingerprint is C909 5602 B0A7 F2A5 1567 8A7D 3192 CCDC CD63 43A5

To claim this, I am signing this object:

@jcushman
jcushman / example.sql
Created February 9, 2017 19:40
Store JSON history with the fast-json-patch library and Postgresql triggers
-- Enable pl/v8:
CREATE EXTENSION plv8;
-- Create json history table:
CREATE TABLE json_history (id BIGSERIAL PRIMARY KEY, tstamp timestamp DEFAULT now(), table_name text, column_name text, target_id bigint, transform json);
-- Create test table:
CREATE TABLE test_json (id BIGSERIAL PRIMARY KEY, data JSON);
-- Enable history tracking on test_json.data:
@jcushman
jcushman / Dockerfile
Last active December 7, 2017 19:19
Reproduction of celery bug #2682, autoscale causes billiard to raise WorkerLostError
FROM python:3.6-stretch
RUN pip install celery
RUN mkdir /app
WORKDIR /app
"""Celery master is too aggressive about suppressing .get() in eager tasks.
test performs no synchronous operations, but fails in eager application::
python minimal_eager_chord.py shell --config=minimal_eager_chord
test.delay().get()
"""
import celery
from celery.canvas import chord
app = celery.Celery()
### install pyenv for Mac with bash ###
# install pyenv
brew install pyenv
# install pyenv-virtualenv
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
# configure pyenv
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile