This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# modify the cookbook | |
knife spork bump <cookbook> | |
knife cookbook upload <cookbook> | |
knife spork promote <environment> <cookbook> | |
knife environment from file <environment>.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def format_timedelta(td): | |
"""formats a timedelta into the largest unit possible | |
>>> from datetime import timedelta | |
>>> format_timedelta(timedelta(weeks=2)) | |
'2w' | |
>>> format_timedelta(timedelta(weeks=2, minutes=2)) | |
'20162m' | |
>>> format_timedelta(timedelta(days=2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
datetime_to_epoch | |
~~~~~~~~~~~~~~~~~ | |
Takes a (naive) UTC datetime and converts to epoch | |
""" | |
from calendar import timegm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
coinbase | |
~~~~~~~~ | |
Real time Coinbase trades and orders using their Websocket Feed | |
https://docs.exchange.coinbase.com/?python#overview | |
""" | |
import asyncio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
orders_source | |
~~~~~~~~~~~~~ | |
Puts coinbase orders into Concord | |
""" | |
import time | |
import json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import re | |
import subprocess | |
import sys | |
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)') | |
CHECKS = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.files.storage import get_storage_class | |
from storages.backends.s3boto import S3BotoStorage | |
class CachedS3BotoStorage(S3BotoStorage): | |
""" | |
S3 storage backend that saves the files locally, too. | |
""" | |
def __init__(self, *args, **kwargs): | |
super(CachedS3BotoStorage, self).__init__(*args, **kwargs) | |
self.local_storage = get_storage_class( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def columns(size, columns=30): | |
""" | |
Return the number of items in each of X columns given a number. | |
Basically the idea is to find exact or next largest rectangle of a given | |
number and given amount of columns. Then fill each column evenly. | |
""" | |
nearest_rect = 0 | |
column_items = [0 for i in xrange(columns)] | |
for index in xrange(columns): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
var API_URL = "http://3n7g.localtunnel.com"; | |
function newMap(lat, lng) { | |
var prevMap = $("#map img"); | |
prevMap.css("z-index", 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
transducers | |
~~~~~~~~~~~ | |
Lazy evaluation of things over a stream. In this case we do a word count | |
""" | |
import types | |
import operator |
OlderNewer