Skip to content

Instantly share code, notes, and snippets.

View birkin's full-sized avatar

Birkin James Diana birkin

View GitHub Profile
@birkin
birkin / mysql_to_tsv.sh
Last active January 26, 2026 01:44
Script to export all non-view db-tables from a MySQL database to TSV files.
#!/usr/bin/env bash
# Script to export all tables (other than "views") from a MySQL database to TSV files.
# You'll be prompted for the password for each export.
# WILL overwrite existing files in the output directory.
set -euo pipefail # ensures pipeline fails if any command in the pipeline fails
# user-configurable variables ---------------------------------------
MYSQL_BIN="/PATH/TO/mysql"
@birkin
birkin / CALLEE.sh
Created January 7, 2026 22:15
backup CALLEE file for uv-toml projects
#!/bin/bash
## assumes `uv` is installed and available in PATH
## Usage: `bash ./CALLER.sh`, which sets vars and then runs `source /path/to/CALLEE.sh`
## helper code ------------------------------------------------------
## function for calls below
function reset_group_and_permissions () {
@birkin
birkin / AGENTS.md
Last active January 19, 2026 12:46
Instruction-file for both github-copilot and IDE-agents.

AGENTS.md — Repository Agent Instructions (Source of Truth)

This file defines the canonical coding directives for this repository.

If other instruction files exist (Copilot, IDE rules, contributor docs) and conflict with this file, follow this file and treat the others as stale.

Project basics

  • Primary language: Python
@birkin
birkin / cds_spacy_anything.py
Created November 20, 2025 13:49
cds_spacy_anything
# /// script
# requires-python = "==3.12.*"
# dependencies = [
# "spacy~=3.8.0",
# "en_core_web_sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl"
# ]
# ///
import argparse
from collections import Counter
@birkin
birkin / cds_spacy_example.py
Last active November 20, 2025 12:42
demoing uv remote execution
# /// script
# requires-python = "==3.12.*"
# dependencies = [
# "spacy~=3.8.0",
# "en_core_web_sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl"
# ]
# ///
from collections import Counter
@birkin
birkin / hello_world.py
Created November 20, 2025 11:33
temp-testing
print( 'Hello World' )
@birkin
birkin / load_boatload_via_ajax.html
Last active October 15, 2025 13:52
javascript showing two approaches to loading lots of images -- but only a few at a time
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Thumbnail Loader — Ordered Queue & Viewer-Aware Queue</title>
<style>
:root { --gap: 10px; --bg: #0b1020; --card: #11172a; --ink: #e8ecff; --muted: #a6b0d9; }
html, body { margin:0; padding:0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui,-apple-system,Segoe UI,Roboto,sans-serif; }
header { position: sticky; top: 0; z-index: 5; background: linear-gradient(180deg, rgba(11,16,32,.96), rgba(11,16,32,.8)); border-bottom: 1px solid #223; }
@birkin
birkin / calc_collection_size.py
Last active September 8, 2025 02:11
calculates BDR collection size for given collection-pid. (#repository #public-repo-tools)
# /// script
# requires-python = "==3.12.*"
# dependencies = [
# "httpx"
# ]
# ///
"""
Computes total byte-size for a BDR collection and returns the size in both bytes and human-readable form.
@birkin
birkin / ruff.toml
Created September 3, 2025 16:48
ruff.toml template
## settings ##
line-length = 125
indent-width = 4
target-version = "py38"
[format]
docstring-code-format = false
indent-style = "space"
line-ending = "auto"
quote-style = "single"
@birkin
birkin / pyproject.toml
Last active January 14, 2026 13:00
pyproject.toml template (#llm_code_directives)
[project]
name = "bdr-student-uploader-hub-project"
version = "0.0.0"
description = "Allows staff to easily and quickly create and configure webapp-uploader for students."
readme = "https://github.com/Brown-University-Library/bdr_student_uploader_hub_project/blob/main/README.md"
requires-python = ">=3.12,<3.13"
dependencies = [
"beautifulsoup4~=4.13.0",
"Django~=5.2.0",
"httpx~=0.28.0",