Skip to content

Instantly share code, notes, and snippets.

View tjsingleton's full-sized avatar

TJ Singleton tjsingleton

View GitHub Profile
@tjsingleton
tjsingleton / llm-wiki.md
Created June 9, 2026 15:14 — forked from karpathy/llm-wiki.md
llm-wiki

LLM Wiki

A pattern for building personal knowledge bases using LLMs.

This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.

The core idea

Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.

# swap loops so we can exit early from the inner loop once we've searched the valid range
require "pp"
require "minitest/autorun"
class StockTest < Minitest::Test
attr_accessor :loops
def pick_best_time_to_buy(stock)
best_value = 0
function lazyCompileFactory(id, html) {
crunch.global.templates[id] = function(context) {
var compiled = Handlebars.compile(html);
crunch.global.templates[id] = compiled;
return compiled(context);
}
}
$('script[type="text/x-handlebars-template"]').each(function() {
var text = this.textContent;
@tjsingleton
tjsingleton / Chef Solo Bootstrap with Ruby 2.2.2
Last active November 5, 2021 21:41 — forked from nyxwulf/Chef Bootstrap Ruby 1.9.3-p194
Chef Solo Bootstrap with Ruby 2.2.2
#!/usr/bin/env bash
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev libffi-dev libjemalloc-dev
apt-get -y install autoconf curl bzip2
apt-get -y autoremove
apt-get -y clean
cd /usr/local/src
curl http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz
@tjsingleton
tjsingleton / parser_plugin.rb
Created April 26, 2011 03:50 — forked from plukevdh/parser_plugin.rb
A nonsensical example of what I want to do. Someone please fill in the blanks.
module Parser
@formats = {}
class << self
attr_accessor :formats
def create(format)
formats[format].new
end
end
# super-meta object persistence class to Redis
class RedisObject
include ActiveModel::Serialization
attr_accessor :attributes, :id
class_attribute :namespace
class_attribute :redis
class << self
def namespace
<?php // BRAD
$numbers = array("1", "2", "3", "4", "5");
function array_print($values) {
$array = array_reverse($values);
print_values($array);
}
function print_values($array) {
echo array_pop($array);
# you can turn two tests into one if you are testing almost the same thing
# example
before(:each) do
@project = Project.new
end
it "should contain errors on a blank url" do
@project.save
@project.errors.should include({:url=>["can't be blank"]})
end
# you can turn two tests into one if you are testing almost the same thing
# example
before(:each) do
@project = Project.new
end
it "should contain errors on a blank url" do
@project.save
@project.errors.should include({:url=>["can't be blank"]})
end