Skip to content

Instantly share code, notes, and snippets.

@chriscarrollsmith
Last active July 9, 2025 11:42
Show Gist options
  • Save chriscarrollsmith/87a41eb91fac52b7c57a51ec277bc2d5 to your computer and use it in GitHub Desktop.
Save chriscarrollsmith/87a41eb91fac52b7c57a51ec277bc2d5 to your computer and use it in GitHub Desktop.
Writeup of submissions to the Coders' Colaboratory `llm` hackathon in Latham, New York

Projects

Runner-Up: Doctor of Credit

Prerequisites

Google Chrome CLI entrypoint

To get dynamically rendered page content from the command line, you can install Google Chrome and use it headlessly.

Linux

You should have access to the google-chrome binary by default after installing Chrome on Linux.

MacOS

On MacOS, install Chrome and set a symlink to the Chrome binary:

ln -s /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome /usr/local/bin/google-chrome
Windows

After installing Chrome on Windows, find your Chrome path (either "C:\Program Files\Google\Chrome\Application" or "C:\Program Files (x86)\Google\Chrome\Application") and create a google-chrome.bat file in "C:\Windows\System32" with the correct path:

@echo off
start "" "C:\Program Files\Google\Chrome\Application\chrome.exe" %*

(This should work across Windows shells, but note that you'll want to run the commands below in Git Bash for syntax compatibility. Or better yet, just use Ubuntu in WSL2 and install and use Chrome there instead.)

strip-tags

To strip HTML tags from the page content, install strip-tags (another handy Python-based command-line utility from the developer of llm). I recommend you install it with uv, which you can get here.

uv tool install strip-tags
# or, if you must, `pip install strip-tags`

Usage

You can use headless Chrome to get the HTML from the Doctor of Credit website (which aggregates current bank deposit bonus offers), then pipe it to strip-tags for conversion to plain text, and finally pipe the cleaned text to llm to extract structured data:

google-chrome --headless --disable-gpu --dump-dom https://www.doctorofcredit.com/best-bank-account-bonuses/ | \
  strip-tags --minify | \
  llm "Return JSON with the bank name, bonus name, deposit amount as an integer quantity in dollars, required deposit duration to earn the bonus (in days), and notes on any other requirements. Only return the JSON; no other text." \
    --extract \
    --schema-multi "bankName: string, bonusName: string, depositAmount: int, depositDuration: int, notes: string[]" \
  > results.json

You can then process the output data however you want—filter by deposit amount, calculate ROI ratios, etc.—to find the most attractive offer you qualify for.

Runner-Up: Natural Language Command-Line Tools

  • Creator: Christopher Smith
  • Description: Create a natural language version of any command-line tool, powered by llm.

The Pitch: Generate a Template from --help, Then Use It to Generate and Directly Run Commands

We can turn the help output of any command-line tool (in this case, repomix) into a prompt template for writing a command:

# Note: escape dollar signs in help output with `sed`
llm --system "Use the help output to generate a 'repomix' command to achieve the user's objective(s). Only return the command, no other text.\n$(repomix --help | sed 's/\$/\\$/g')" \
  --save repomix

Then we can use the template to generate a command using natural language:

llm "Pack all the Markdown files in the current folder" --template repomix -x

(If the model returns the command as a fenced code block, the -x flag will extract it.)

The model returns the command we want:

repomix --include "*.md"

Now we can pipe the command to bash to execute it:

llm "Pack all the Markdown files in the current folder" --template repomix -x | bash

This successfully packs all the Markdown files in the current folder to repomix-output.xml!

The Product: Natural Language Executables

With a tiny shell script, we can package this pipeline as an executable:

#!/bin/bash

# nl-repomix - Natural language interface to repomix
# Usage: nl-repomix "Pack all the Markdown files in the current folder"

if [ $# -eq 0 ]; then
    echo "Usage: nl-repomix \"<natural language prompt>\""
    echo "Example: nl-repomix \"Pack all the Markdown files in the current folder\""
    exit 1
fi

# Pass the prompt to llm with the repomix template, extract the command, and execute it
llm "$1" --template repomix -x | bash 

If we make it executable and add it to PATH...

chmod +x nl-repomix
# for demo purposes, add to PATH just for the current session
export PATH="$PWD:$PATH"

...we can use it like this:

nl-repomix "Pack all the Markdown files in the current folder"

Scaling It

With very little effort, you could programmatically create templates and natural-language executables for any command-line tool! I created a naive sample implementation here. Just pass a CLI tool's name to create-nl-tool.sh, and it will spin up a template and output an nl-<name> file.

(However, to make this really useful in practice, you'd need to solve how to recursively get help output for all subcommands, and also how to handle failure cases or cases where the tool doesn't do what the user wants.)

Winner: Semantic Search Over the "Big Beautiful Bill"

You can download the full text of the budget bill that just passed Congress and strip the HTML tags to get a plain text file:

curl -o- https://www.congress.gov/119/bills/hr1/generated/BILLS-119hr1eas.html | \
  iconv -f utf-8 -t utf-8//IGNORE | \
  strip-tags --minify > budget_bill.txt

Then split the bill into chunks exactly 6,000 bytes long:

mkdir bbbw
split -b 6000 budget_bill.txt bbbw/temp_chunk_

Then you can use llm to embed the chunks.

First, set a default embedding model:

llm embed-models default text-embedding-3-small

Then embed the chunks:

llm embed-multi bbbw --files bbbw 'temp_chunk_*' --store  # store plain text with embeddings

And now you can run a semantic search over the bill:

llm similar bbbw -c "no SNAP for you!" -p  # return plain text

Or chain llm commands to do RAG:

llm similar bbbw -c "agricultural policy" -p | \
  llm "What does the budget bill say about agricultural policy?"

Output:

The budget bill outlines various agricultural policies, primarily focused on support for farmers, insurance provisions, disaster assistance, and funding for conservation and research initiatives. Key elements include:

  1. Base Acre Allocation: The Secretary of Agriculture is responsible for allocating base acres based on historical planting data and natural disasters affecting eligible farms from 2019 to 2023. This ensures that base acres are distributed in proportion to the commodities planted during that period.

  2. Payment Yields: Starting from the 2026 crop year, the bill establishes payment yields connected to the base acres allocated. If no payment yield exists for a commodity on a farm, an alternative yield based on county averages may be used.

  3. Increased Funding for Conservation Programs: The bill provides significant funding for conservation initiatives through existing programs, with specified amounts allocated for different fiscal years up to 2031.

  4. Support for Beginning Farmers: There are provisions for increased premium assistance for beginning farmers and ranchers participating in crop insurance programs. This includes additional percentage points of premium subsidy during their initial years of participation.

  5. Livestock and Crop Insurance Revisions: Adjustments are proposed in livestock indemnity payments, disaster assistance for livestock, and alterations to the marketing loan provisions, including increased rates for specific crops and extended eligibility periods.

  6. Research and Development: The bill allocates funding for agricultural research, particularly focusing on urban and emerging agricultural practices, as well as improvements in agriculture technology and market access.

  7. Disaster Assistance Updates: There are updates to the disaster assistance programs, including livestock forage disaster payments and emergency assistance for livestock losses due to predation or adverse weather.

  8. Emergency Assistance Initiatives: A new section introduces support for farm-raised fish affected by bird depredation, outlining eligibility and payment rates for such loss situations.

Overall, the budget bill seeks to enhance the stability and sustainability of the agricultural sector through supportive measures for farmers, focused funding for critical initiatives, and adjustments to existing assistance programs consistent with past practices and recent hardships experienced by the agricultural community.

@chriscarrollsmith
Copy link
Author

Video presentation of this material: https://youtu.be/lQnBPqIpc2A?si=M-RFa0QWFRFx0RiU

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment