Skip to content

Instantly share code, notes, and snippets.

@Sachaa-Thanasius
Sachaa-Thanasius / accounting.sql
Created April 3, 2024 15:46 — forked from NYKevin/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...
@Sachaa-Thanasius
Sachaa-Thanasius / refinement_draft.py
Last active June 18, 2024 02:16
Proto-draft implementation of a potential Refinement typeform in Python. Not official, just my first pass at it for fun. Reference: https://discuss.python.org/t/pep-746-typedmetadata-for-type-checking-of-pep-593-annotated/53834
# pyright: enableExperimentalFeatures=true
# PEP 712 is only active for pyright with the "enableExperimentalFeatures" setting enabled.
import operator
import re
import sys
from typing import (
TYPE_CHECKING,
Callable,
ClassVar,
import ast
import os
import sys
from io import BytesIO
from typing import TYPE_CHECKING, Tuple, Union
if sys.version_info >= (3, 10) or TYPE_CHECKING:
StrPath = Union[str, os.PathLike[str]]
else:
StrPath = Union[str, os.PathLike]
@Sachaa-Thanasius
Sachaa-Thanasius / kaltura_file_download.md
Created June 2, 2024 19:18 — forked from giansegato/kaltura_file_download.md
How to download a video from Kaltura video service

Kaltura Video Downloader

Also known as: find and merge m3u8 files

⚠️ WARNING ⚠️ → use this guide at your sole discretion.

Check the copyright laws and the term of service before using it. You might be breaking the law!


  1. Open the Network tab of the Chrome Inspector
@Sachaa-Thanasius
Sachaa-Thanasius / rfc_3986_regex.py
Created June 18, 2024 00:41 — forked from kenballus/rfc_3986_regex.py
A direct translation from RFC3986's collected ABNF to python regexes.
# unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
UNRESERVED_PAT: str = r"([A-Za-z0-9\-\._~])"
# pct-encoded = "%" HEXDIG HEXDIG
PCT_ENCODED_PAT: str = r"(%[A-F0-9][A-F0-9])"
# sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
SUB_DELIMS_PAT: str = r"([!\$&'\(\)\*\+,;=])"
# pchar = unreserved / pct-encoded / sub-delims / ":" / "@"