Skip to content

Instantly share code, notes, and snippets.

@studiotomi
studiotomi / gist:d25e7dbe42a6019fdc08
Created June 19, 2015 15:36
Work on Chunks of an array
def chunks(l, n):
""" Yield successive n-sized chunks from l.
http://stackoverflow.com/a/312464/1572077
"""
for i in xrange(0, len(l), n):
yield l[i:i+n]
@studiotomi
studiotomi / async_downloader.py
Last active August 28, 2019 15:00
Asyncrounous Anything in python 3
import threading
from queue import Queue
class AsyncThread(threading.Thread):
"""
Based off of ssynchronous downloading script pull from stackoverflow
http://stackoverflow.com/questions/18883964/asynchronous-file-downloads-in-python
"""
def __init__(self, queue, func):