Skip to content

Instantly share code, notes, and snippets.

View earonesty's full-sized avatar


View GitHub Profile
earonesty /
Created October 9, 2023 22:03
very simple pub/priv key module using coincurve
import base64
import os
from hashlib import sha256
from typing import Optional
import coincurve as secp256k1
"""Minimalist pub/priv key classes for signing and verification based on coincurve"""
class PublicKey:
name = "ai-worker"
version = "0.1.0"
description = "api server that posts capabilities, and accepts jobs"
authors = ["erik aronesty <>"]
license = "MIT"
readme = ""
packages = [{include = "ai_worker"}]
class TestUniqueQueue(unittest.TestCase):
def test_basic(self):
q = util.UniqueQueue()
for i in range(100):
res = set(q)
for i in range(100):
class FutureWaitQueue:
"""Wait for futures without making an infinite list.
Any exceptions are ignored at put() time, except for timeout errors, which are raised.
The last exception raised is raised at wait() time
def __init__(self, maxsize, timeout, err_on_timeout=concurrent.futures.TimeoutError):
"""Construct a future wait queue.
#!/usr/bin/env python3
import sys
from tracemalloc import Snapshot
def main():
# todo: argparser
fil = sys.argv[1]
num = 10
if len(sys.argv) > 2:
num = int(sys.argv[2])
import os
import sys
import json
import math
from runstats import Statistics, Regression
__all__ = ["randtest", "randtestall", "buildstats"]
def primes(givenNumber):
# Initialize a list
earonesty / gist:c1cd4c634cfc1f9e3f34d0b4b056651c
Created March 21, 2022 21:55
extremely simple lru set in python
class LRUSet(set):
def __init__(self, *args, max_size=None, **kws):
self.max_size = max_size
super().__init__(*args, **kws)
def add(self, ent):
if len(self) >= self.max_size:
Generate api-style github markdown-files from python docstrings.
qpydoc my_module >
import re
# allows you to say with mock_run(...):
# ....
# good for testing scripts that do a lot of calls
class CmdMatch(NamedTuple):
cmd: str
matches: str = ".*"
result: str = ""
side_effect: Union[Callable, Exception] = None
import requests
import string
import random
import argparse
import json
def main():
parser = argparse.ArgumentParser(description='Post cryptoquips')
parser.add_argument("--generate", action="store_true")