Skip to content

Instantly share code, notes, and snippets.

@nathania
nathania / llm-wiki.md
Created July 29, 2026 17:10 — 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.

@nathania
nathania / installation.md
Created February 14, 2023 18:32 — forked from juliasilge/installation.md
Installing R + Tensorflow on M1
@nathania
nathania / move_slides_to_web.R
Created March 31, 2019 13:14 — forked from malcolmbarrett/move_slides_to_web.R
Move R Markdown HTML slides to Blogdown and Push to Web
# install.packages(c("here", "fs", "stringr", "purrr", "git2r"))
# to add invisibly in your R profile, open with usethis::edit_r_profile()
# then define it in an environment, e.g.
# .env <- new.env()
# .env$move_slides_to_web <- {function definition}
move_slides_to_web <- function(folder = NULL, index = NULL) {
if (is.null(folder)) {
@nathania
nathania / RStudio Community reply 2019-03-13
Last active March 14, 2019 02:32
RStudio Community reply: How to apply a plotting function to a list of dataframes *and* a character vector
# https://community.rstudio.com/t/how-to-apply-a-plotting-function-to-a-list-of-dataframes-and-a-character-vector/26033
library(tidyverse)
library(scales)
library(naniar)
# original viz ------------------------------------------------------------
cols <- c('Good' = '#1a9641',
@nathania
nathania / ruler.R
Created March 12, 2019 20:31 — forked from hadley/ruler.R
ruler <- function(width = getOption("width")) {
x <- seq_len(width)
y <- dplyr::case_when(
x %% 10 == 0 ~ as.character((x %/% 10) %% 10),
x %% 5 == 0 ~ "+",
TRUE ~ "-"
)
cat(y, "\n", sep = "")
cat(x %% 10, "\n", sep = "")
}
@nathania
nathania / RStudio_rawdatalistr_untitled_C4A976C6
Last active March 12, 2019 19:58
generate all 2^(dim(S)) combinations of elements from a set S
# `expand(df, nesting(patient, PCP), event_type)`
# generates all unique combinations in `(patient, PCP) x event_type`.
# That is; there will be `n_distinct(df$event_type)` rows per `patient, PCP`
# tuple in the data
#
# df <- tibble(x = 1:4, y = letters[1:4])
# testthat::expect_equivalent(expand(df, nesting(x, y)), distinct(df, x, y))
# testthat::expect_equivalent(expand(df, crossing(x, y)), expand(df, x, y))
# generate all combinations of elements in a set S
@nathania
nathania / rotate-axis-labels-ggplot2.R
Created December 9, 2018 01:01 — forked from benmarwick/rotate-axis-labels-ggplot2.R
I can never remember how to rotate the x-axis labels with ggplot2: theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5))
# Adapted from https://stackoverflow.com/a/7267364/1036500 by Andrie de Vries
library(ggplot2)
td <- expand.grid(
hjust=c(0, 0.5, 1),
vjust=c(0, 0.5, 1),
angle=c(0, 45, 90),
text="text"
)
@nathania
nathania / pub_med.py
Created March 16, 2017 19:41 — forked from ehazlett/pub_med.py
Search PubMed with BioPython
#!/usr/bin/env python
# numpy and biopython are required -- pip install numpy biopython
from Bio import Entrez
from Bio import Medline
MAX_COUNT = 10
TERM = 'Tuberculosis'
print('Getting {0} publications containing {1}...'.format(MAX_COUNT, TERM))
@nathania
nathania / SassMeister-input-HTML.html
Created October 13, 2015 15:04
Generated by SassMeister.com.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<div class="rating">
<span><i class="fa fa-male"></i></span>
<span><i class="fa fa-male"></i></span>
<span><i class="fa fa-male"></i></span>
<span><i class="fa fa-male"></i></span>
<span><i class="fa fa-male"></i></span>
</div>