Skip to content

Instantly share code, notes, and snippets.

@qexat
qexat / spec.txt
Last active January 30, 2024 08:38
CyTUI `FormattedTextElement` format spec
@status DRAFT
@version
MAJOR 1
MINOR 0
REV 5
all specifiers produce an escape sequence.
DEFINITIONS
• Tag: text surrounded by brackets that signal the start of a formatted
@qexat
qexat / aprint.py
Created January 14, 2024 16:57
async typewriting
import argparse
import asyncio
import os
import sys
import typing
class APrintNamespace(typing.Protocol):
message: str
tasks: int
@qexat
qexat / .pythonrc
Last active April 17, 2026 16:14
my .pythonrc (2026.04.17)
#!/usr/bin/env python3
# pyright: reportUnusedCallResult = false, reportUnusedImport = false
# ruff: noqa: DTZ005, T201
"""
.pythonrc is a file which is executed when the Python interactive shell is
started if $PYTHONSTARTUP is in your environment and points to this file.
It's just regular Python code, so do what you will. Your ~/.inputrc file
can greatly complement this file.
@qexat
qexat / eep_sort.py
Created December 31, 2023 20:48
eep sort
from __future__ import annotations
import asyncio
import collections.abc
import io
import os
import random
import sys
import time
import typing
@qexat
qexat / pills.py
Created December 31, 2023 20:47
message pills
import dataclasses
import io
import os
import re
import shutil
import textwrap
import typing
Color8Type: typing.TypeAlias = typing.Literal[0, 1, 2, 3, 4, 5, 6, 7, 9]
@qexat
qexat / slides.py
Created December 27, 2023 14:47
terminal slides lol
import abc
import collections.abc
import os
import shutil
import sys
import time
import typing
class RGBColor(typing.NamedTuple):
@qexat
qexat / lexer.qut
Last active September 18, 2024 18:17
half finished lexer
type TokenType =
| COMMENT
| IDENTIFIER
| INTEGER
| REAL
| CHARACTER
| STRING
| LEFT_BRACE
| LEFT_BRACKET
| LEFT_PAREN
@qexat
qexat / cpp.py
Created December 14, 2023 02:27
cppython
# pyright: reportUnusedExpression = false
import dataclasses
import os
import sys
import typing
@dataclasses.dataclass(slots=True)
class CPPFile:
@qexat
qexat / singleton.py
Created December 6, 2023 20:31
cursed singleton in pure python
from __future__ import annotations
import os
import typing
_ALREADY_EXISTS = "cannot instantiate singleton class {!r}: the instance already exists"
class SingletonMeta(type):
@qexat
qexat / cursed.py
Created November 30, 2023 21:32
whatever this is
from __future__ import annotations
import abc
import collections.abc
import dataclasses
import functools
import typing
T = typing.TypeVar("T")
U = typing.TypeVar("U")