Skip to content

Instantly share code, notes, and snippets.

View delivrance's full-sized avatar
🐈
ฅ^•ﻌ•^ฅ

Dan delivrance

🐈
ฅ^•ﻌ•^ฅ
View GitHub Profile
@delivrance
delivrance / tgcrypto_bench.py
Last active August 10, 2022 02:09
TgCrypto benchmark
# https://github.com/pyrogram/tgcrypto
import os
import time
import tgcrypto
def fmt(d, s):
return f"{len(d) / (time.time() - s) / 1024 / 1024 :.2f} MB/s"
@delivrance
delivrance / ainput.py
Last active April 9, 2024 11:21
Python async input
import asyncio
from concurrent.futures import ThreadPoolExecutor
async def ainput(prompt: str = "") -> str:
with ThreadPoolExecutor(1, "AsyncInput") as executor:
return await asyncio.get_event_loop().run_in_executor(executor, input, prompt)
async def main():