Skip to content

Instantly share code, notes, and snippets.

View birkin's full-sized avatar

Birkin James Diana birkin

View GitHub Profile
@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 September 25, 2025 12:10
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",
@birkin
birkin / RH_server_specs.sh
Last active September 3, 2025 11:35
bash script to print out a bunch of server info.
#!/usr/bin/env bash
# Usage:
# bash ./RH_server_specs.sh | tee "$HOME/rh_server_specs_$(hostname -s)_$(date +%Y%m%dT%H%M%S%z).txt"
set -euo pipefail
section(){ printf '\n==== %s ====\n' "$1"; }
section "OS / KERNEL"
@birkin
birkin / aeon_file_comparison.md
Created August 28, 2025 17:11
aeon file comparison experimentation

Aeon diff: customization likelihood report

This report scores each changed file on the likelihood that differences reflect local customizations (vs vendor upgrade changes).

How to read: higher percentages suggest text that looks Brown/JHL-specific was removed/changed; lower percentages suggest generic Aeon features were added or structural changes came from upstream.


include_footer.html

  • probability_of_customization: 100.0%
@birkin
birkin / warc_gist_experimentation.json
Created August 28, 2025 15:23
warc gist experimentation for tracking downloaded warcs
{
"files": [
{
"seedId": "seed123",
"crawlJobId": "job456",
"crawlTimestamp": "20171003231334202",
"service": "ARCHIVEIT",
"collectionId": 7310,
"filePath": "/pairtree/73/10/warcs/20171003231334202-00000.warc.gz",
"serialNumber": "00000",
@birkin
birkin / replace_spaces_with_underscores.py
Last active August 14, 2025 02:48
uv run gist experimentation
# /// script
# requires-python = "==3.12.*"
# ///
"""
Just replaces spaces with underscores; that's all!
Part of experimentation for using `uv run THE-GIST-URL`
Usage:
@birkin
birkin / new_uv_pyprojecttoml_code_update_script.sh
Last active July 25, 2025 16:50
new-style uv/pyproject.toml code-update-script
## (server-name) DEV-SERVER code update script for '(project-name)' project -- using new uv-pyproject.toml architecture
## setup ------------------------------------------------------------
echo " "; echo "--------------------"; echo " "; echo "DEPLOY-START"; echo " "
echo ":: setting envars..."
GROUP="(the-group)"
LOG_DIR_PATH="/path/to/stuff/logs/"
PROJECT_DIR_PATH="/path/to/stuff/project/" # for `git pull`
STATIC_MEDIA_DIR_PATH="/path/to/html/django_media/(project)_media/"
@birkin
birkin / uv_workshop.md
Last active July 8, 2025 16:41
`uv` unconference workshop description

Introducing uv

Python is a friendly language, used by a wide-variety of folk in the Library -- from back-end developers to folk exploring digital-humanities text-mining and web-scraping to others exploring AI to others doing data-cleanup.

But too often there's friction in the process of getting code running because of the need to install:

  • various versions of python
  • a virtual-environment (venv)
  • various packages.

This workshop -- no programming experience required -- will introduce the python package-manager "uv", which has become incredibly popular because it removes lots of that friction, allowing people to focus more on their work/exploration/research, rather than "setup". It also helps collaboration, by making it easier for others using uv to use your scripts.

@birkin
birkin / load_gsheet_data.py
Created July 4, 2025 16:15
access public google spreadsheet
# /// script
# requires-python = "==3.12.*"
# dependencies = [
# "polars",
# "httpx"
# ]
# ///
"""
Example of accessing a public google-sheet ("Anyone with the link can view")