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 March 10, 2025 02:55
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
@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 February 18, 2025 21:43
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
This uses llm.datasette.io and OpenAI.
I use `git commit --template` to provide the output from the LLM to Git. This way, if you do not like the results, you
can quit your editor and no commit will be made.
# Shell function for generating a diff and editing it in your default editor:
gcllm() {
GIT_DIR="$(git rev-parse --git-dir)"
TEMPLATE="$GIT_DIR/COMMIT_EDITMSG_TEMPLATE"