Skip to content

Instantly share code, notes, and snippets.

View waynegraham's full-sized avatar

Wayne Graham waynegraham

View GitHub Profile
@waynegraham
waynegraham / worker.js
Created August 30, 2026 18:55
Cloudflare image worker
const OCI_REGION = "me-riyadh-1";
const OCI_NAMESPACE = "YOUR_NAMESPACE";
const OCI_BUCKET = "YOUR_BUCKET";
export default {
async fetch(request) {
const url = new URL(request.url);
if (request.method !== "GET" && request.method !== "HEAD") {
return new Response("Method not allowed", {
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>DSC00047 — Diplomatic transcription</title>
<style>
:root {
color-scheme: light;
--paper: #f6f1e6;
@waynegraham
waynegraham / celebi-map.json
Last active June 1, 2026 12:13
Çelebi Map
{
"@context": "http://iiif.io/api/presentation/3/context.json",
"id": "https://localhost/manifest/evliya-celebi-nile-scroll.json",
"type": "Manifest",
"label": {
"en": [ "Evliya Çelebi's Nile Map (Stitched Scroll View) - Vat.turc.73" ]
},
"description": {
"en": [ "A single-canvas compilation of the 7 primary vertical segments of the Nile Scroll manuscript for unified georeferencing." ]
},
@waynegraham
waynegraham / 01_README.md
Last active April 27, 2026 15:10
Postgresql Vector Search example

This gist has SQL scripts to pull data into PostgreSQL and perform a demo "similarity" search.

Create database

CREATE TABLE iab_assets (
    id SERIAL PRIMARY KEY,
    iab_code TEXT,
    title TEXT,
    origin TEXT,
@waynegraham
waynegraham / chart.md
Last active January 26, 2026 19:10
Mermaid chart

Infrastructure

flowchart TB

%% User Experience Layer
UX["User Experience Layer<br/>• Public Web Experience<br/>• Research Interfaces<br/>• Admin Interfaces<br/><i>(Biennale Artistic & Curatorial Identity)</i>"]

%% Search & Access
#!/usr/bin/env python3
import os
import subprocess
from pathlib import Path
from concurrent.futures import ProcessPoolExecutor, as_completed
import multiprocessing
# Input and output directories
INPUT_DIR = "data" # change to your directory of PDFs
OUTPUT_DIR = "ocr_output"
@waynegraham
waynegraham / mailer.php
Created October 30, 2024 16:09
PHP Mailer Test
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require './vendor/autoload.php';
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/');
$dotenv->load();
@waynegraham
waynegraham / update.sh
Last active January 30, 2024 18:11
Update StopForumSpam Blocked IPs
#!/bin/bash
#
# Pull updated IPs from StopForumSpam from
# https://www.stopforumspam.com/downloads. Note that different files have
# different download limits. Generally you can download the last day hourly and
# everything else you are limited to twice daily.
#
# URL: https://github.com/waynegraham/UpdateBlockedIPs
# Author: Wayne Graham
# License: MIT
@waynegraham
waynegraham / _footer.scss
Created September 5, 2023 17:51
CLIR footer in Bootstrap
@waynegraham
waynegraham / creat_test_files.py
Created August 26, 2023 19:08
Create text files for LORA model
import os
import shutil
def create_text_file(jpeg_file):
"""Creates a text file with the same name as the given JPEG file."""
text_file_name = jpeg_file.split(".")[0] + ".txt"
text_file = open(text_file_name, "w")
text_file.write("")
text_file.close()