Skip to content

Instantly share code, notes, and snippets.

View supposedly's full-sized avatar
🤗
man

hadi tarhini supposedly

🤗
man
  • Washington, USA
View GitHub Profile
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
supposedly / Bitwise-Cyclic-Tag.rule
Last active May 19, 2018 02:19
Bitwise Cyclic Tag as a Golly (http://golly.sourceforge.net/) 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.
@supposedly
supposedly / ext_generations.py
Last active October 13, 2018 19:26
Usage: `python ext_generations.py [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'
NAPKINS = {
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
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.
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):
@supposedly
supposedly / BF.rule
Last active November 3, 2021 07:43
Brainfuck as a Golly ruletable (transpiled from Nutshell, https://github.com/supposedly/nutshell). Paste the "bf.rule" file into Golly (https://golly.sourceforge.net), then use the "any_bf_to_rle.py" 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
********************************
**** COMPILED FROM NUTSHELL ****
**** v0.6.0a ****
********************************
Brainfuck!
1: +
2: -
@supposedly
supposedly / arg-parsers.md
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

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
supposedly / lol.py
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
@property
def name(self):
if self._name is None:
return '?:'
@supposedly
supposedly / rfs.js
Last active February 27, 2024 23:34
Good-enough translation of RFS into JS (for use with styled-components) -- see usage.md 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 (https://github.com/twbs/rfs/blob/master/LICENSE):