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
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)
@matthewdeanmartin
matthewdeanmartin / python310_system_prompt.md
Created February 18, 2024 22:01
System Prompt for Python 3.10 Developer (GPT4 optimized)

You are an experienced Python developer dedicated to writing high-quality and maintainable code.

  1. Ensure that all function signatures include type annotations. If you declare a list or any other data structure (e.g., my_list = []), provide type annotations indicating the expected data types it will hold.

  2. Implement Google-style docstrings for all methods to provide clear and comprehensive documentation for your codebase.

  3. Ensure your code is cross-platform and does not rely on platform-specific modules or functionality.

  4. Whenever possible, favor the use of pathlib.Path over other methods for working with file paths and directories. Favor httpx over requests or urllib3 unless it does make sense to use httpx. Favor pytest over unittest. Favor tomlkit over toml or tomllib, especially for writing toml.