Skip to content

Instantly share code, notes, and snippets.

View chriscarrollsmith's full-sized avatar

Christopher Carroll Smith chriscarrollsmith

View GitHub Profile
@chriscarrollsmith
chriscarrollsmith / create-nl-tool.sh
Created July 9, 2025 00:05
Create a natural-language version of any command-line tool, powered by `llm`
#!/bin/bash
# create-nl-tool.sh - Programmatically create natural language interfaces
# for CLI tools
# Usage: ./create-nl-tool.sh <tool-name>
# Example: ./create-nl-tool.sh repomix
set -e
if [ $# -eq 0 ]; then
@chriscarrollsmith
chriscarrollsmith / llm-hackathon-submissions.md
Last active July 9, 2025 11:42
Writeup of submissions to the Coders' Colaboratory `llm` hackathon in Latham, New York

Projects

Runner-Up: Doctor of Credit

Prerequisites

Google Chrome CLI entrypoint

@chriscarrollsmith
chriscarrollsmith / llm-hackathon.md
Created July 5, 2025 13:56
Coders' Colaboratory mini-hackathon on `llm` by simonw

Let's hack on llm!

If you have uv installed (and you should!), you can install llm globally in a uv-managed tool environment with:

uv tool install llm

If you want to use models other than OpenAI models, you'll need some extensions:

@chriscarrollsmith
chriscarrollsmith / pre-push
Created July 1, 2025 20:19
pre-push git hook to only allow pulling from, not pushing to, a template remote
#!/bin/bash
# Pre-push hook to prevent pushing from the template branch
# This allows pulling from template remote but prevents accidental pushes
current_branch=$(git symbolic-ref --short HEAD)
if [ "$current_branch" = "template" ]; then
echo "ERROR: Pushing from the 'template' branch is not allowed."
echo "This branch is reserved for pulling updates from the template repository."
@chriscarrollsmith
chriscarrollsmith / Zotero_schema.md
Created June 2, 2025 01:35
Zotero Local Database Schema Documentation

Exploring the Zotero Local Database Schema

On my (Windows) machine, Zotero's local database was located at C:\Users\chris\Zotero\zotero.sqlite. I was able to dump the schema using the sqlite3 command line tool:

sqlite3 zotero.sqlite ".schema" > zotero_schema.sql

Here is the SQL schema dump:

@chriscarrollsmith
chriscarrollsmith / setup_digital_ocean_db.sh
Created March 26, 2025 19:52
End-to-end setup script for deploying a PostgreSQL database and optional droplet (for API layer) to Digital Ocean using `doctl` in Bash
#!/bin/bash
# Exit on error
set -e
# Load environment variables if .env exists
if [ -f .env ]; then
export $(cat .env | grep -v '^#' | xargs)
fi
@chriscarrollsmith
chriscarrollsmith / create-gif.py
Created March 2, 2025 19:50
Python script to create an animated gif
from PIL import Image
import os
def create_gif(image_folder, gif_name, frame_duration=200):
"""
Creates an animated GIF from images in a folder.
Args:
image_folder (str): Path to the folder containing the images.
gif_name (str): Name of the output GIF file.
@chriscarrollsmith
chriscarrollsmith / sse-demo.py
Last active February 10, 2025 00:58
Demo showing how to use HTMX to split an SSE event stream
from fastapi import FastAPI, Request
from fastapi.responses import HTMLResponse, StreamingResponse
import time
app = FastAPI()
index_html = """
<html>
<head>
<!-- Include htmx -->
@chriscarrollsmith
chriscarrollsmith / Rconfig.R
Last active June 9, 2025 20:15
VSCode- & Cursor-friendly R configuration
#!/usr/bin/env Rscript
# R Setup Script
# Author: Christopher Smith
# Date: 2024-10-07
# Prerequisites: Install R and IDE (manual steps, not included in script)
# Define the mirror URL (edit as needed)
cran_mirror <- "https://lib.stat.cmu.edu/R/CRAN/"
@chriscarrollsmith
chriscarrollsmith / helloworld.py
Last active September 8, 2024 17:55
That feeling when you're falling in love with Python for the very first time
def greet():
# You are my heart
my_heart = {"my <3": "you"}
# My heart stops when you enter the room
sentiment = "Be still, my beating <3!".replace("beating ", "")
# Unlock me baby
key_to_my_heart = list(my_heart.keys())[0]
# I carve out my heart and replace it with you
epiphany = sentiment.replace(key_to_my_heart, my_heart[key_to_my_heart])
# Well, hello there ;)