Skip to content

Instantly share code, notes, and snippets.

View billdueber's full-sized avatar

Bill Dueber billdueber

View GitHub Profile
@billdueber
billdueber / rapid-mlx-serve-help.txt
Created July 1, 2026 21:30
rapid-mlx serve --help
usage: rapid-mlx serve [-h] [--served-model-name SERVED_MODEL_NAME]
[--force-disk-check] [--host HOST] [--port PORT]
[--listen-fd FD]
[--log-level {DEBUG,INFO,WARNING,ERROR}]
[--max-num-seqs MAX_NUM_SEQS]
[--max-concurrent-requests MAX_CONCURRENT_REQUESTS]
[--prefill-batch-size PREFILL_BATCH_SIZE]
[--completion-batch-size COMPLETION_BATCH_SIZE]
[--enable-prefix-cache] [--disable-prefix-cache]
[--prefix-cache-size PREFIX_CACHE_SIZE]
const fs=require('fs');
const t=fs.readFileSync('captures/test/index.html','utf8');
const r=fs.readFileSync('captures/reference/index.html','utf8');
const idxs=[];
for(let i=0;i<t.length;i++) if(t[i]==='�') idxs.push(i);
console.log('replacement count',idxs.length);
for(const i of idxs){
const pre=t.slice(Math.max(0,i-40),i);
const post=t.slice(i+1,i+40);
const marker=pre+post;
@billdueber
billdueber / _prompt.md
Last active February 26, 2026 19:49
Digital Repo API

Create a programming-langague-independent API for a modern headless archival digital repository for an academic research library. Start with an overall list of the major functions that need to be supported text that explains what the general functionality area covers, then list individual endpoints under each heading along with possible arguments and error conditions that would need to provide feedbasck via the return values.

//----------- STRINGS ---------------
fun string_stuff() {
// fstring / text blocks
val name = "Alice"
val age = 30
val message = "Hello, $name, you are $age. In ten years you'll be ${age + 10}."
val longer = """
This is a much longer string. It can also do interpolation.
require "benchmark/ips"
require "marc"
require "../lib/marc/jsonl_reader"
require "zinzout"
source_file = "/Users/dueberb/devel/mlibrary/data/search_full_bibs/all.jsonl.gz"
temp_file = "/tmp/500k.bat"
require "pathname"

Summarize the algorithm described between START and STOP

START

This is the process:

  1. Take the first 12 digits of the 13-digit ISBN

  2. Multiply each number in turn, from left to right by a number. The first digit is multiplied by 1, the second by 3, the third by 1 again, the fourth by 3 again, and so on to the eleventh which is multiplied by 1 and the twelfth by 3.

  3. Add all of the 12 answers.

@billdueber
billdueber / README.md
Created December 6, 2022 03:14
Truffleruby JSON parsing slow on previously-gzipped data

Benchmark JSON parsing: gzipped vs. non-gzipped data

This is a very simple, self-contained (well, except for benchmark-ips) benchmark. Conceptually, it does the following:

  • Create an array-of-arrays, each element being a 20-element array of integers
  • Write it out to a file as JSON
  • Write it out to a gzipped file as JSON
  • Read them both back in as strings
  • Compare how long it takes to JSON.parse the never-gzipped (plain) string vs the previously-gzipped string

Usage via slow_gzip_bench.rb -h

@billdueber
billdueber / rsolr_streamer.rb
Last active January 13, 2022 17:18
Simple RSolr extension to use a cursor-based stream to iterate over docs in a solr core
# frozen_string_literal: true
# # Simple example -- get ids and titles of all items without an author
#
# rsolr = RSolr.connect(url: 'http://localhost:8025/solr/catalog')
# stream = rsolr.streamer(handler: 'select') do |s|
# s.filter = 'NOT author:[* TO *]'
# s.sort = 'id asc'
# s.fields = ['id', 'title']
# s.batch_size = 2_000
@billdueber
billdueber / aael.xml
Created April 8, 2021 17:59
Alma document from AAEL
<?xml version="1.0" encoding="UTF-8"?>
<collection>
<record>
<leader>00000nas a2200000 i 4500</leader>
<controlfield tag="001">990155606890206381</controlfield>
<controlfield tag="005">20190626105359.0</controlfield>
<controlfield tag="008">170919c20179999miuuu p 6 0 a0eng d</controlfield>
<datafield tag="035" ind1=" " ind2=" ">
<subfield code="a">(MiU)015560689MIU01</subfield>
</datafield>
@billdueber
billdueber / slip_flow.md
Last active March 31, 2021 20:41
Basic path through slip

SLIP flow for normal (non-print-holdings or collection-builder) items

A basic run through of how things move through SLIP.

DB Tables overview

  • slip_rights: (one row per item). A copy-ish of rights_current with additional information about when an item was last updated. Populated/updated from vufind solr.
  • slip_queue: (one row per item-to-update). A list of HTIDs along with slots to hold information about which (if any) process is