Skip to content

Instantly share code, notes, and snippets.

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

csjh

🐞
compiling just in time
  • 01:29 (UTC -05:00)
View GitHub Profile
@csjh
csjh / engine.py
Last active December 13, 2025 05:52
regex compiler
"""
Example Usage (assuming engine.py is in the same folder as the Python file you're working in):
import engine
regex = engine.RegEx("aa.*b")
assert regex.test("aaLETTERSb") == True
assert regex.test("bLETTERSb") == False
"""
@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: