This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from asyncio import run | |
from os import environ | |
from atproto import AsyncClient, client_utils, models | |
def chunked(text, *, size): | |
buf = [] | |
for ln in text.splitlines(): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from ctypes import c_void_p, c_char_p, c_long, c_int, c_size_t, py_object, \ | |
Structure, POINTER, cdll | |
from opcode import HAVE_ARGUMENT, opmap | |
from itertools import imap, chain | |
from copy import deepcopy | |
from sysconfig import get_config_vars | |
from sys import version_info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from itertools import tee, islice, zip_longest, chain, repeat | |
nwise = lambda g, *, n=2: zip(*(islice(g, i, None) for i, g in enumerate(tee(g, n)))) | |
nwise_longest = lambda g, *, n=2, fv=object(): zip_longest(*(islice(g, i, None) for i, g in enumerate(tee(g, n))), fillvalue=fv) | |
first = lambda g, *, n=1: zip(chain(repeat(True, n), repeat(False)), g) | |
last = lambda g, *, m=1, s=object(): ((xs[-1] is s, x) for x, *xs in nwise_longest(g, n=m+1, fv=s)) | |
if __name__ == '__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
class TaggedMethods(type): | |
def __new__(cls, name, bases, body): | |
tags = {} | |
for name, attr in ((k,v) for k,v in body.items() if isinstance(v, Tag)): | |
tags.setdefault(attr.tag, []).append(name) | |
body[name] = attr.func | |
body['methods_by_tag'] = property(lambda s: {k:[getattr(s,a) for a in v] for k,v in tags.items()}) | |
return type.__new__(cls, name, bases, body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from ast import parse | |
from ast import AST, FunctionDef, Lambda, Call | |
from collections import Iterable | |
# some notes | |
# kwargh: | |
# when you're using matplotlib or pandas | |
# and you do help(func) to figure out what |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def foo(self, _): | |
pass | |
class T: | |
from json import dumps | |
from itertools import repeat | |
foo = foo | |
def bar(self, _): | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from random import Random | |
from itertools import combinations, chain | |
from collections import defaultdict, Counter | |
from statistics import mean | |
letters = {1: 'aeilnorstu', 2: 'dg', 3: 'bcmp', 4: 'fhvwy', 5: 'k', 8: 'jx', 10: 'qz'} | |
tiles = {v: k for k, vs in letters.items() for v in vs} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: hook | |
CC=gcc -std=c99 -Wall | |
hook: hook-main hook-preload.so | |
./hook-main | |
LD_PRELOAD=./hook-preload.so ./hook-main | |
hook-main: hook-main.c | |
${CC} -O0 -Wl,--export-dynamic -g -ggdb -o $@ $^ -ldl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Coroutines</title> | |
</head> | |
<body> | |
<div id="root"></div> | |
<script src="index.jsx" async type="module"></script> | |
</body> | |
</html> |
NewerOlder