Skip to content

Instantly share code, notes, and snippets.

View jmhobbs's full-sized avatar

John Hobbs jmhobbs

View GitHub Profile
@jmhobbs
jmhobbs / README.md
Last active January 2, 2019 15:51
Delayed queues for RQ.

Example Run

RQ Worker

✪ rqworker --db 10 default high
16:06:30 RQ worker started, version 0.3.7
16:06:30 
16:06:30 *** Listening on default, high...
16:06:49 high: jobs.multiply(5, 2) (2df52ba2-bd32-4849-a8e1-c5241c78b542)
16:06:49 Job OK, result = 10
@jmhobbs
jmhobbs / keybase.md
Created May 25, 2018 20:36
Keybase Proof

Keybase proof

I hereby claim:

  • I am jmhobbs on github.
  • I am jmhobbs (https://keybase.io/jmhobbs) on keybase.
  • I have a public key whose fingerprint is 5616 12FF A10D 9D7A 7FFB 75F4 F79C 72E6 EDC7 0E38

To claim this, I am signing this object:

@jmhobbs
jmhobbs / Dockerfile
Last active September 8, 2017 18:46
HDC Kubernetes Demo
FROM scratch
ADD main /
EXPOSE 8080
CMD ["/main"]
@jmhobbs
jmhobbs / coinbase_break_even_calculator.py
Created December 18, 2013 19:34
I wanted to know when I would break even (including fees) on some bitcoins I bought on coinbase. So I built a brute force calculator.
# -*- coding: utf-8 -*-
BANK_FEE = 0.15
COINBASE_PCT = 0.01
def calculate_sale_profit(coins, price, purchase_cost):
value = round(coins * price, 2)
fee = BANK_FEE + round(value * COINBASE_PCT)
return (value - fee) - purchase_cost
@jmhobbs
jmhobbs / setup.sh
Created March 28, 2017 15:22
Transmission Server Setup (untested)
TRANSMISSION_RPC_PASSWORD="set something here"
add-apt-repository -y ppa:transmissionbt/ppa
apt-get -y update
apt-get install -qy nginx transmission-cli transmission-daemon
ufw status
ufw allow 22
ufw allow 443
ufw allow 1194
@jmhobbs
jmhobbs / post-commit
Last active December 19, 2016 04:36
git post commit hook to harvest active timer
#!/usr/local/bin/python
import requests
import subprocess
# Configure Your Info Here
DOMAIN = "https://YOU.harvestapp.com"
USERNAME = ""
PASSWORD = ""
# / End Config
@jmhobbs
jmhobbs / deadline.coffee
Created November 12, 2011 07:36
Hubot script to track deadlines.
# Tracks when stuff is due.
#
# deadlines - List what you have due
# add deadline 2011-10-30 Thing - Add a deadline for October 10, 2011
# remove deadline Thing - Remove a deadline named "Thing"
# clear deadlines - Remove all the deadlines
#
# Written by @jmhobbs
module.exports = (robot) ->

Keybase proof

I hereby claim:

  • I am jmhobbs on github.
  • I am jmhobbs (https://keybase.io/jmhobbs) on keybase.
  • I have a public key whose fingerprint is D8E5 99E7 D1FF 62B0 9FD6 016C 2580 C0BE 34EB 9490

To claim this, I am signing this object:

@jmhobbs
jmhobbs / brute_force_gift_exchange.py
Last active January 1, 2016 11:59
Problem: There are six cousins, three sets of siblings. They are drawing for a gift exchange, and none of them can get their sibling. How many combinations are possible. Math is hard, so I wrote a brute force, which I think is correct. This could be more generic. The nested loops are gross.
siblings = {1: 2, 2: 1, 3: 4, 4: 3, 5: 6, 6: 5}
cousins = set(siblings.keys())
# Start by getting all the possible pairings for each person.
possible_pairings = {1: set(), 2: set(), 3: set(), 4: set(), 5: set(), 6: set()}
for i in cousins:
for j in cousins - set((i, siblings[i])):
possible_pairings[i].add(j)
combinations = []
@jmhobbs
jmhobbs / as_working.py
Last active December 25, 2015 07:49
Issue with Flask 0.10.1 documentation as written.
# -*- coding: utf-8 -*-
import sys
from flask import Flask, url_for
app = Flask(__name__)
@app.route("/")