Skip to content

Instantly share code, notes, and snippets.

View andrix's full-sized avatar

Andrés Moreira andrix

View GitHub Profile
@andrix
andrix / notifycotiz.py
Created August 29, 2011 20:01
Notificador de cambio de cotización | Brou | Gales
import os
import sys
import time
import urllib
import pynotify
import cPickle
import signal
from scrapy.selector import HtmlXPathSelector
@andrix
andrix / iunzip.py
Created July 4, 2011 13:33
python iterable unzip
import itertools
from operator import itemgetter
def iunzip(iterable):
"""Iunzip is the same as zip(*iter) but returns iterators, instead of
expand the iterator. Mostly used for large sequence"""
_tmp, iterable = itertools.tee(iterable, 2)
iters = itertools.tee(iterable, len(_tmp.next()))
return (itertools.imap(itemgetter(i), it) for i, it in enumerate(iters))