Skip to content

Instantly share code, notes, and snippets.

View stevedomin's full-sized avatar
🛫
Taking off

Steve Domin stevedomin

🛫
Taking off
View GitHub Profile
@stevedomin
stevedomin / llm-wiki.md
Created June 8, 2026 08:19 — 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.

import Swoosh.Email
upload_invoice = %Plug.Upload{
path: "/tmp/plug/DEFfF014AaA01F",
content_type: "",
filename: "invoice-peter-may.pdf"
}
new()
|> to("peter@example.com")
@stevedomin
stevedomin / simple_attachment.ex
Last active May 6, 2017 09:46
simple_attachment
import Swoosh.Email
new()
|> to("peter@example.com")
|> from({"Jarvis", "jarvis@example.com"})
|> subject("Invoice May")
|> text_body("Here is the invoice for your superhero services in May.")
|> attachment("/Users/jarvis/invoice-peter-may.pdf")
@stevedomin
stevedomin / empty.ex
Last active February 21, 2016 19:59
empty changeset with Ecto 2.0
#
# pre ecto 2.0
#
# web/models/user.ex
defmodule User do
schema "users" do
field :name
field :email
end
@stevedomin
stevedomin / mybank.ex
Created January 15, 2016 21:05
How to test an API client in Elixir?
defmodule MyBank.Client do
defstruct client_id: nil, access_token: nil
def request(client, method, path, params \\ %{}, body \\ nil, headers \\ []) do
# prepare url, headers, etc.
case HTTPoison.request(method, url, body, headers) do
{:ok, %HTTPoison.Response{status_code: 200, body: body}} -> {:ok, body}
# handle other cases ...
end
end
@stevedomin
stevedomin / iex
Created September 7, 2015 21:29
Process.info/2 weirdness
iex(1)> pid = spawn fn -> end
#PID<0.61.0>
iex(2)> Process.info(pid, :status)
nil
iex(3)> Process.info(pid, :status)
nil
iex(4)>
@stevedomin
stevedomin / form.html.eex
Last active March 17, 2016 10:54
Phoenix example form
<%= form_for @changeset, @action, fn f -> %>
<div>
<%= label f, :name %>
<%= text_input f, :name %>
</div>
<div>
<%= submit "Submit" %>
</div>
<% end %>
@stevedomin
stevedomin / ex_playground.conf
Created August 12, 2015 23:32
Elixir Playground upstart conf
description "ex_playground"
setuid ex_playground
setgid ex_playground
start on runlevel [2345]
stop on shutdown
respawn
respawn limit 10 20
@stevedomin
stevedomin / create_post.exs
Last active December 26, 2024 09:19
Using UUIDs as primary key with Ecto
defmodule MyBlog.Repo.Migrations.CreatePost do
use Ecto.Migration
def change do
create table(:posts, primary_key: false) do
add :id, :uuid, primary_key: true
add :body, :string
add :word_count, :integer
timestamps
@stevedomin
stevedomin / porcelain_spawn_receive.exs
Last active August 29, 2015 14:16
Porcelain spawn/receive
alias Porcelain.Process
alias Porcelain.Result
defmodule Cmd do
def run() do
args = ["b"]
opts = [
in: "a\nb\nc\nb\nb\nd\nb\ne",
out: {:send, self()},
err: {:send, self()} # eksperimental -> This is the only thing that changed