Skip to content

Instantly share code, notes, and snippets.

View supposedly's full-sized avatar

hadi tarhini supposedly

  • Washington, USA
View GitHub Profile
from decimal import Decimal # for accurate math
ZERO = Decimal('0')
# I don't know what to actually call this but it's for different
# node types
# eg do `P = Unit(); NP = Unit(); VP = Unit(); etc`
# The class overrides the > + operators to make it easy to write
# relationships, like P > NP or VP > V+NP
class Unit:
supposedly /
Last active May 5, 2022 01:54
u have become the very thing u swore to destroy (a regex DSL guy)
class _Group:
def __init__(self, *patterns, name=None):
self._patterns = list(patterns)
self._name = name
self._force_group = False
def name(self):
if self._name is None:
return '?:'
supposedly / rfs.js
Last active February 27, 2024 23:34
Good-enough translation of RFS into JS (for use with styled-components) -- see for usage info
SCSS RFS mixin - converted unofficially to JS
Please note that the author(s) and maintainer(s) of RFS aren't responsible for this port. Direct issues to @supposedly
Automated responsive values for font sizes, paddings, margins and much more
Licensed under MIT (
supposedly / emptytextfile.txt
Created November 6, 2018 02:27
FREE empty text file free of charge make sure to tell all ur friends
We couldn’t find that file to show.
supposedly / BF.rule
Last active November 3, 2021 07:43
Brainfuck as a Golly ruletable (transpiled from Nutshell, Paste the "bf.rule" file into Golly (, then use the "" script and paste its output into Golly (& hit Enter) to execute your bf program. Also, turn on Golly's icons so the cells display as actual symbols!
@RULE bf
**** v0.6.0a ****
1: +
2: -
supposedly /
Last active October 13, 2018 19:26
Usage: `python [output directory] [rulestring] [OPTIONAL rulename for the output file]
import sys
from os import path
ACTIVE, INACTIVE = 'active', 'inactive' # For convenience/ease of renaming the variables, should need be
# TODO: Consider reordering alphabetically to match Golly
N_HOODS = 'cekainyqjrtwz'
k: dict(zip(N_HOODS, ([INACTIVE if state == '0' else ACTIVE for state in npk] for npk in v))) for k, v in {
'0': '',
'1': ('00000001', '10000000'),
supposedly /
Last active December 16, 2021 09:53
This list is probably out of date. It hasn't been updated since September 2019.

Big ol' list of third-party Python 3 argparse alternatives

Bold+italics means the lib is probably worth checking out above the rest. joffrey is my own.

argparse wrappers

import inspect
from functools import wraps
from itertools import islice, starmap
def _callable(obj):
return callable(obj) and obj is not inspect._empty
def convert(hint, val):
import pkg_resources
import platform
import os
from collections import defaultdict
from inspect import cleandoc
import asyncpg
import discord
from discord.ext import commands
supposedly / Bitwise-Cyclic-Tag.rule
Last active May 19, 2018 02:19
Bitwise Cyclic Tag as a Golly ( ruletable.
@RULE bct
An implementation of bitwise cyclic tag.
state 0: Vacuum.
state 1: Data-tape 0.
state 2: Data-tape 1.
state 3: Program-tape 0.