This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from argparse import ArgumentParser | |
from collections import namedtuple | |
from contextlib import AsyncExitStack | |
from ipaddress import IPv4Address, IPv6Address, IPv4Network, IPv6Network | |
from signal import signal, SIGHUP, SIGINT, SIGTERM | |
from socket import socket, AF_INET, AF_INET6, SOCK_STREAM, IPPROTO_IP, IP_TRANSPARENT, SHUT_WR | |
import asyncio as aio | |
import logging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Thank you to the folks at the C++ slack channel, | |
// along with @lewissbaker for the excellent literature | |
// (even though it took me a few days to be convinced | |
// it really was so). | |
#include <uv.h> | |
#include <iostream> | |
#include <experimental/coroutine> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import time | |
def timeit(func): | |
async def process(func, *args, **params): | |
if asyncio.iscoroutinefunction(func): | |
print('this function is a coroutine: {}'.format(func.__name__)) | |
return await func(*args, **params) | |
else: |