Skip to content

Instantly share code, notes, and snippets.

View csjh's full-sized avatar
🐞
compiling just in time

csjh

🐞
compiling just in time
  • 06:11 (UTC -05:00)
View GitHub Profile
@csjh
csjh / engine.py
Last active December 4, 2025 14:24
regex compiler
from typing import Callable, Union
# ascii is [0, 128)
MAX_CHAR = 0x80
EPSILON = 0
class RegEx:
# dummy reference so mmap isn't freed before we're done
coderef: Buffer
@csjh
csjh / parse.py
Created October 17, 2022 06:11
finds 5 five letter words with 25 unique letters
from string import ascii_lowercase
from typing import Dict, Set
import requests
ascii_set = set(ascii_lowercase)
words = list(filter(lambda x: len(x) == 5 and len(set(x)) == 5 and len(set(x).intersection(set('aeiou'))) < 2, requests.get('https://raw.githubusercontent.com/dwyl/english-words/master/words_alpha.txt').text.split()))
adj_list: Dict[str, Set[str]] = dict()
letters_dict: Dict[str, Set[str]] = dict()
for letter in ascii_lowercase: