Skip to content

Instantly share code, notes, and snippets.


Rich Jones Miserlou

View GitHub Profile
apetresc /
Created December 31, 2010 08:30
A modified version of the AWS SDK for Android sample code which fetches credentials from awskeyserver.
cspanring / pagination.html
Created November 8, 2011 02:53
linaro django pagination template for Bootstrap framework
View pagination.html
{# use in combination with #}
{# and #}
{# project-dir/templates/pagination/pagination.html #}
{% if is_paginated %}
{% load i18n %}
<div class="pagination">
{% block previouslink %}
{% if page_obj.has_previous %}
mboersma /
Last active May 26, 2017 06:43
Build Docker on Mac OS X and run it as a client connected to a Linux VM running the docker daemon.

Run Docker client on Mac OS X connected to a Linux VM

Official Mac Docker Binary!

None of this is really necessary now that the Docker team is releasing official Mac OS X binary builds. Please see moby/moby#3337 for details.

Doerge /
Last active July 5, 2017 18:03
Basic app for testing flask-zappa functionality.
# -*- coding: utf-8 -*-
from flask import Flask, request, redirect, url_for, session, abort, current_app, json
app = Flask(__name__)
# This is the very unsecret key from the Flask-docs
app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
tobsn / info.txt
Last active November 24, 2017 13:06 — forked from rpgreen/master.vm
API Gateway "Send Everything" Mapping Template
View info.txt
location/cookie headers:
dhimmel / bitcoin-random-outcomes.ipynb
Last active January 29, 2018 19:14
Using Bitcoin to randomly determine a future outcome involving untrusted parties
View bitcoin-random-outcomes.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
bjinwright /
Created December 7, 2016 22:50
Custon S3 Django-Storages backend made for use with CloudFront with multiple origins
from django.conf import settings
from django.utils.encoding import filepath_to_uri
from storages.backends.s3boto import S3BotoStorage
class StaticStorage(S3BotoStorage):
location = settings.STATICFILES_LOCATION
def url(self, name, headers=None, response_headers=None, expire=None):
return '{}{}'.format(settings.STATIC_URL,filepath_to_uri(name))
iepathos / sorting_example_by_subdict_key
Last active May 4, 2018 15:11
Explicitly sorting a dictionary by a sub-dictionary subkey into an ordered list.
View sorting_example_by_subdict_key
# Dictionaries are inherently orderless, but lists are ordered!
import collections
d = { '123': { 'key1': 3, 'key2': 11, 'key3': 3 },
'124': { 'key1': 6, 'key2': 56, 'key3': 6 },
'125': { 'key1': 7, 'key2': 44, 'key3': 9 } }
results_list = []
sort_by_dict = {}
nkrumm /
Created December 23, 2013 07:14
DIY Direct-to-S3 Aspera solution. This snipped monitors a directory for new files (uploaded via aspera, for example) and then starts a background s3cmd job to upload those files Using the --partial-file-suffix=.part for the ascp command ensures that inotifywait only gets trigger when the file is finished uploading.
inotifywait -m -e moved_to $BASE | while read line
F=$(echo $line | cut -f3 -d" ")
echo "Now uploading $F"
s3cmd --force --no-progress put $F s3://mybucket/ &
peterhurford /
Last active August 24, 2018 18:46
Find the best deals in AWS spot instances across all availability zones and multiple instance types
# For every AWS availability zone and instance I care about, check the spot
# price for the last ninety days and generate stats about which spot instance
# gives the best deal.
import boto
import boto.ec2
from vowpal_platypus.utils import mean
REGIONS = {'us-east-1': ['us-east-1a', 'us-east-1b', 'us-east-1c', 'us-east-1e'],