Skip to content

Instantly share code, notes, and snippets.

View unbracketed's full-sized avatar

Brian Luft unbracketed

View GitHub Profile
@unbracketed
unbracketed / image-to-text-model-comparison.py
Created February 4, 2025 19:32
Processes a directory of images using a few image-to-text models and outputs tables for comparing the processing times and generated captions
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "click",
# "torch",
# "transformers",
# "Pillow",
# "rich",
# "pandas",
# ]
@unbracketed
unbracketed / image-caption-demo.py
Created February 3, 2025 23:31
A Python script that will apply image-to-text transformations for any images found in the directory it runs in using a few different models for comparison.
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "torch",
# "transformers",
# "Pillow",
# ]
# ///
from pathlib import Path
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "starlette",
# "uvicorn",
# "beautifulsoup4",
# "httpx",
# "html5lib"
# ]
# ///
@unbracketed
unbracketed / Repeater-FastTag-for-FastHTML.md
Last active August 3, 2024 08:13
Docs about how to make a Repeater FastTag for easily rendering lists or tables of data

Repeater FastTag

This intended as a utility component for rendering lists, iterables, or sequence-type objects, with a goal of providing useful results with minimal configuration, while allowing all aspects of rendering to be easily overridden.

Source

class Repeater:
    """

Keybase proof

I hereby claim:

  • I am unbracketed on github.
  • I am brianluft (https://keybase.io/brianluft) on keybase.
  • I have a public key ASDA8arUp9wX5w0-kz7yGMdizo_BF-XSpQ-OtIPuddcBrQo

To claim this, I am signing this object:

@unbracketed
unbracketed / RC300_sync.py
Last active July 11, 2019 04:26
Utility for managing BOSS RC-300 memory slots and settings
import csv
import os
import shutil
import logging
log = logging.getLogger(__name__)
UPLOAD_QUEUE = "~/.rc300-queue.csv"
RC300_BASE = "/Volumes/BOSS_RC-300/ROLAND/"
@unbracketed
unbracketed / branch-fu.md
Created April 7, 2015 17:49
Moving commits between branches

Example: Moving up to a few commits to another branch

Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.

cherry-pick does support a range of commits, but if you have merge commits in that range, it gets really complicated

git checkout branch-B
git cherry-pick X
git cherry-pick Y
@unbracketed
unbracketed / Matches.jsx
Last active August 29, 2015 14:17
Riff on Omniscient-style component
//http://omniscientjs.github.io/playground/02-search/
// content component (pure)
var Match = React.createClass({
render: () => {(
<li>
<a href="{this.props.url}">{this.props.title}</a>
</li>
)}
})
@unbracketed
unbracketed / heroku-copy-config.sh
Created November 26, 2014 18:04
Heroku copy config
#!/bin/bash
set -e
sourceApp="$1"
targetApp="$2"
while read key value; do
key=${key%%:}
echo "Setting $key=$value"
@unbracketed
unbracketed / yyyymmdd.js
Last active August 29, 2015 14:06
Javascript date formatter YYYYMMDD
Date.prototype.yyyymmdd = function() {
var yyyy = this.getFullYear().toString();
var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based
var dd = this.getDate().toString();
return yyyy + '-' + (mm[1]?mm:"0"+mm[0]) + '-' + (dd[1]?dd:"0"+dd[0]);
};
d = new Date();