Skip to content

Instantly share code, notes, and snippets.

View matthewdeanmartin's full-sized avatar
🦥
(Not) Looking for work. Probably employed until March 2026.

Matthew Martin matthewdeanmartin

🦥
(Not) Looking for work. Probably employed until March 2026.
View GitHub Profile
import re
import unicodedata
def strip_accents(s: str) -> str:
# NFD: decomposes "ï" -> "i" + "¨"
# Then we drop all combining marks (category "Mn")
return "".join(
c for c in unicodedata.normalize("NFD", s)
if unicodedata.category(c) != "Mn"
soit clone https://stackoverflow.com/q/12345 --answer 67890 --branch my-so-project
cd my-so-project
ls
answer.md code0.js code1.js
nano code1.js
soit push
soit branch "refactored-solution"
# This push creates a brand new answer on the Stack Overflow post.
soit push -m "Feat: A more performant and modern solution"
# Pull edits made by moderator, etc
# Update: fix the unbiased bit extractor to use *disjoint* pairs of independent samples,
# which makes the 4-bit blocks uniform (so digits 0..9 after rejection are uniform).
# Re-run the whole pipeline and tests.
import hashlib
import math
from collections import Counter
from dataclasses import dataclass
from typing import Iterable, List, Sequence, Tuple
@matthewdeanmartin
matthewdeanmartin / randomish.py
Created August 24, 2025 17:58
Algorithm for a human to generate 1000 pseudorandom numbers per hour
import collections
import math
import re
def seeded_text_key_scramble(source_text, secret_key, start_word_index, num_digits, verbose=False):
"""
Generates a sequence of pseudo-random digits based on a source text and a secret key.
Args:

Recommended policy compliance practices

Hachiderm's policy borderline "bot can only broadcast". So Riker Googling would probably pass, but an LLM bot like activist probably wouldn't.

Transparency

  • Mark account as bot in profile.
  • Optionally add #bot tag to each post, or other indication that it is AI generated.
  • If hosted on Hachiderm, add #hachybots to all posts.
@matthewdeanmartin
matthewdeanmartin / CloudCustodianDummysGuide.md
Created October 14, 2024 13:41 — forked from Johnlon/CloudCustodianDummysGuide.md
Work in progress write up on adding an extension to cloud custodian
@matthewdeanmartin
matthewdeanmartin / thread.py
Created September 10, 2024 12:58
svcs support for single thread, multiple threads, multiple processes. WIP
# SPDX-FileCopyrightText: 2023 Hynek Schlawack <[email protected]>
#
# SPDX-License-Identifier: MIT
# pylint: disable=global-statement
from __future__ import annotations
import atexit
import contextvars
import inspect
from collections.abc import Callable, Generator
@matthewdeanmartin
matthewdeanmartin / bot_policies.md
Created September 2, 2024 20:23
Common bot policies Sept 2024 for top Mastodon Servers

Mastodon Servers and bot policies

I manually checked these policies September 2024. All servers could vary in how they enforce their written policies.

There might be a chance?

  • mas.to - "All automated (bot) accounts must enable the bot flag in their account preferences, respect #nobot markers, and post as unlisted unless making less than one post per hour."
  • mastodon.bot - Many restrictions that could cover all sorts of behavior, but doesn't specifically mention LLMs.
  1. Poetry:

    poetry shell
  2. Python venv:

    source venv/bin/activate  # On Unix or MacOS
    .\venv\Scripts\activate  # On Windows
"""
Depends on this in conftest.py
```python
import os
import pytest
@pytest.fixture(autouse=True)
def set_tmp_path_env(tmp_path):
os.environ['PYTEST_TMP_PATH'] = str(tmp_path)