Skip to content

Instantly share code, notes, and snippets.

View mjallday's full-sized avatar
🏠
WFH

Marshall Jones mjallday

🏠
WFH
View GitHub Profile
@mjallday
mjallday / currencies.py
Created August 12, 2011 09:09
Tuple of currencies for Python
# -*- coding: utf-8 -*-
"""
list of currencies currently in circulation
taken from http://www.currency-iso.org/iso_index/iso_tables/iso_tables_a1.htm
http://www.iso.org/iso/currency_codes_list-1.html
2011-08-11
"""
@mjallday
mjallday / balanced-bank-account.html
Created November 27, 2012 17:55
Balanced bank account collection form with Bootstrap
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tokenize Bank Account Form - Balanced</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Le styles -->
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css"
rel="stylesheet">
@mjallday
mjallday / README.md
Created July 29, 2014 23:44
New Relic python client, SQLAlchemy and psycopg2 library

If you attempt to register an extension with psycopg2 and happen to use the newrelic python client library you may get an error that looks like this

  File "/opt/balanced/embedded/lib/python2.7/site-packages/psycopg2/_json.py", line 142, in register_default_json
    loads=loads, oid=JSON_OID, array_oid=JSONARRAY_OID)
  File "/opt/balanced/embedded/lib/python2.7/site-packages/psycopg2/_json.py", line 125, in register_json
    register_type(JSON, not globally and conn_or_curs or None)
TypeError: argument 2 must be a connection, cursor or None
@mjallday
mjallday / gist:7590598
Created November 21, 2013 22:04
purge all rabbitmq queues
rabbitmqadmin list queues | cut -d '|' -f 3 | grep -v \+ | xargs -n1 -I@ rabbitmqadmin purge queue name=@
@mjallday
mjallday / README.mkd
Created October 8, 2013 21:21
HANGMAN

Make a client

curl http://balanced-hangman.herokuapp.com

Hopefully you'll see something like

{
 "index": "/", 
 "me": "/me", 
@mjallday
mjallday / redisbuffer.py
Created October 31, 2012 17:06
Redis Circular Buffer
class RedisCircularBuffer(object):
def __init__(self, namespace, size):
self.namespace = namespace
self.size = size
import redis
self.redis = redis.Redis()
def append(self, item):
self.redis.lpush(self.namespace, item)
@mjallday
mjallday / README.md
Last active September 25, 2020 09:47
SQS Latency Measuring

SQS Latency testing

Run this from an ec2 instance in the us-west-1 region.

It will create two queues and feed messages into the first queue with a timestamp, this message will then be read and the difference between the message timestamp and the current time computed and pushed into a response queue. Reading these times will give you the latency between publishing to a queue and receiving the message.

@mjallday
mjallday / analytics.js
Created May 6, 2013 20:01
The API we used for analytics in the old Balanced dashboard.
Balanced.Analytics = (function () {
var myTracker;
var googleQueue;
var TRACK_EVENT = '_trackEvent';
var init = 0;
if (window['_gat'] !== undefined) {
myTracker = _gat._getTrackerByName();
} else {
myTracker = null;
}
@mjallday
mjallday / keybase.md
Created September 5, 2018 17:14
keybase.md

Keybase proof

I hereby claim:

  • I am mjallday on github.
  • I am mjallday (https://keybase.io/mjallday) on keybase.
  • I have a public key whose fingerprint is 5043 3C86 AAD6 968F 3D28 8F98 F439 FD97 E280 4455

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am mjallday on github.
  • I am mjallday (https://keybase.io/mjallday) on keybase.
  • I have a public key whose fingerprint is 5043 3C86 AAD6 968F 3D28 8F98 F439 FD97 E280 4455

To claim this, I am signing this object: