Skip to content

Instantly share code, notes, and snippets.

import dspy
from dspy.evaluate import Evaluate
from dspy.teleprompt import *
import csv
# Load the emails
with open('training.csv', 'r') as file:
reader = csv.DictReader(file)
emails = [row for row in reader]
@imaurer
imaurer / gpush.sh
Last active January 27, 2025 14:43
Script to sync git repo and push with LLM-drafted git message
#!/bin/bash
#
# gpush: Lazy git add, commit, and push with comments written by LLM
#
#
# This script provides an enhanced git push workflow with the following features:
# - Automatically pulls latest changes from the current branch
# - Checks for uncommitted changes
# - Generates commit messages using AI (LLM/Gemini) if no message is provided
# - Allows interactive editing of auto-generated commit messages
@vgel
vgel / r1.py
Last active June 1, 2025 08:44
script to run deepseek-r1 with a min-thinking-tokens parameter, replacing </think> with a random continuation string to extend the model's chain of thought
import argparse
import random
import sys
from transformers import AutoModelForCausalLM, AutoTokenizer, DynamicCache
import torch
parser = argparse.ArgumentParser()
parser.add_argument("question", type=str)
parser.add_argument(
@rajivsinclair
rajivsinclair / Adding a "political spectrum" attribute to VERDAD's analysis prompt - discussion with Claude.md
Last active December 11, 2024 14:06
This is how we revised our analysis prompt to add a new attribute to its output, along with defining the guidelines and generating synthetic examples

Political Spectrum Analysis Prompt

human (Oct 30, 2024, 06:03 PM)

I want to ask the analysis stage llm (a very advanced multimodal LLM) to assess I want to ask the LLM to assess is the snippet politically left-leaning or right-leaning (on a spectrum of -1.0 to +1.0 where -1.0 is extremely left-leaning and +1.0 is extremely right leaning). Please help me to add this to the prompt. Here is the existing prompt that I want you to add it to:

paste.txt
@codeinthehole
codeinthehole / tdd.sh
Created October 13, 2024 14:58
A Bash script for running an iterative TDD loop using an LLM to make a set of tests pass
#!/usr/bin/env bash
#
# A Bash script to run a TDD loop for building a Python module to pass tests.
set -euo pipefail
# How many times to loop.
ATTEMPTS=4
# The system prompt to use when creating the initial version.
@dupontgu
dupontgu / landscape_to_blurred_portrait.sh
Created September 30, 2024 21:45
Shell script to embed a landscape video inside a blurred, portrait version of itself.
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 <input_video>"
exit 1
fi
input_file="$1"
if [ -z "$2" ]; then
@Fronkan
Fronkan / editor.py
Last active June 5, 2025 13:55
A code editor written using textual for a lightning talk. The editor was live-coded and presented in less than 10 minutes.
""" Simple code editor using textual. Live coded during the lightning talk in about 7 minutes
"""
from argparse import ArgumentParser
from pathlib import Path
from textual.app import App
from textual.widgets import TextArea, DirectoryTree
from textual.containers import Horizontal
class Editor(App):
@tosh
tosh / system.md
Created April 29, 2024 17:25
system.md

I have a parquet file named ah.parquet.

It contains Apple Health data and has the following columns:

  • type: Nullable(String)
  • value: Nullable(String)
  • start: Nullable(DateTime64(6))
  • end: Nullable(DateTime64(6))
  • created: Nullable(DateTime64(6))
@RyanBalfanz
RyanBalfanz / llm_webui.py
Created April 16, 2024 02:31
Initial LLM WebUI
import json
import urllib.parse
from dataclasses import InitVar, dataclass
from datetime import datetime, timedelta
from typing import Protocol
import httpx
import llm
import streamlit as st
@montasaurus
montasaurus / llmc.sh
Last active April 1, 2025 18:40
AI Shell Command Generator
llmc() {
local system_prompt='Output a command that I can run in a ZSH terminal on macOS to accomplish the following task. Try to make the command self-documenting, using the long version of flags where possible. Output the command first enclosed in a "```zsh" codeblock followed by a concise explanation of how it accomplishes it.'
local temp_file=$(mktemp)
local capturing=true
local command_buffer=""
local first_line=true
local cleaned_up=false # Flag to indicate whether cleanup has been run
cleanup() {
# Only run cleanup if it hasn't been done yet