Skip to content

Instantly share code, notes, and snippets.

View thanos's full-sized avatar

thanos vassilakis thanos

View GitHub Profile
@almost
almost / glacier.py
Created August 21, 2012 17:59
Amazon Glacier from Python. There's now a branch for this, see here: https://github.com/almost/boto/tree/glacier
# Thomas Parslow http://almostobsolete.net
# Just a work in progress and adapted to what I need right now.
# It does uploads (via a file-like object that you write to) and
# I've started on downloads. Needs the development version of Boto from Github.
#
# Example:
#
# glacierconn = GlacierConnection(AWS_ACCESS_KEY, AWS_SECRET_ACCESS_KEY)
# writer = GlacierWriter(glacierconn, GLACIER_VAULT)
# writer.write(somedata)
@thanos
thanos / kombu_example.py
Created June 14, 2012 23:15
A simple example of a kombu fanout exchange using python generators and coroutines
from kombu import Exchange
from kombu import Queue
from kombu import BrokerConnection
class ProduceConsume(object):
def __init__(self, exchange_name, **options):
exchange = Exchange(exchange_name, type='fanout', durable=False)
queue_name = options.get('queue', exchange_name+'_queue')
self.queue = Queue(queue_name ,exchange)
class Node:
"""
>>> Node(1).append(
... Node(2)).append(
... Node(3)).append(
... Node(4)).append(
... Node(5)).append(
... Node(6)).append(
... Node(7)).append(
... Node(8)).pprint()