Skip to content

Instantly share code, notes, and snippets.

@cetanu
cetanu / fun.py
Created February 16, 2022 15:43
fun with threads
import time
import threading
def thing(key, value, queue, results):
print(f"Processing {key=} {value=}")
# what happens to the thread when there's an exception here?
# the thread should catch it and remove the job from the queue so that
# another can be enqueued.
results[key] = value ** 2
@cetanu
cetanu / async.py
Created January 15, 2021 03:33
async.py
from asyncio.events import get_event_loop
from asyncio.tasks import ensure_future, wait
async def run_sync_task(loop, fn, *args):
return await loop.run_in_executor(None, fn, *args)
def greeting(name):
return f'Hello {name}'
@cetanu
cetanu / dnsBlacklists.txt
Last active May 30, 2018 01:07
DNS Blacklists
b.barracudacentral.org
bl.deadbeef.com
bl.emailbasura.org
bl.spamcannibal.org
bl.spamcop.net
blackholes.five-ten-sg.com
blacklist.woody.ch
bogons.cymru.com
cbl.abuseat.org
cdl.anti-spam.org.cn