Skip to content

Instantly share code, notes, and snippets.

View dnmellen's full-sized avatar
🐙

Diego Navarro dnmellen

🐙
  • Madrid
View GitHub Profile
@nherbaut
nherbaut / java
Last active October 19, 2017 14:32
Sending Celery Task through rabbitmq in Java
package com.mirlitone;
import java.io.IOException;
import org.junit.Test;
import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
@dnmellen
dnmellen / flatten.py
Last active December 29, 2015 04:59
My try for "flatten" with yield from
from collections import Iterable
def flatten(iterable):
for item in iterable:
if isinstance(item, Iterable):
yield from flatten(item)
else:
yield item
@dnmellen
dnmellen / colors.py
Created May 15, 2013 13:32
Auxiliary Python module to get styled terminal outputs in a pythonic way
# encoding: utf-8
# Copyright 2013 Diego Navarro Mellén. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
@jobliz
jobliz / RedisPythonPubSub1.py
Created May 4, 2012 17:58
A short script exploring Redis pubsub functions in Python
import redis
import threading
class Listener(threading.Thread):
def __init__(self, r, channels):
threading.Thread.__init__(self)
self.redis = r
self.pubsub = self.redis.pubsub()
self.pubsub.subscribe(channels)