Skip to content

Instantly share code, notes, and snippets.

@mutolisp
mutolisp / llm-wiki.md
Created June 6, 2026 15:25 — 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.

@mutolisp
mutolisp / postgis1216.sql
Last active December 16, 2020 03:59
postgis_practice20201216
SELECT
id, ST_BUFFER(geom_centroid, 0.0083333) as geom_buff
FROM
(SELECT
1 as id,
ST_SRID(ST_GeomFromText('POLYGON((1 1,2 2,2 0,1 1))', 4326)) as srid,
st_centroid(ST_GeomFromText('POLYGON((1 1,2 2,2 0,1 1))', 4326)) as geom_centroid,
ST_GeomFromText('POLYGON((1 1,2 2,2 0,1 1))', 4326) as geom)
AS s;
@mutolisp
mutolisp / create_test2.sql
Last active December 2, 2020 03:43
Postgis practice 20201202
DROP TABLE IF EXISTS test;
CREATE TABLE test (
id serial,
long double precision,
lat double precision,
country varchar,
species varchar,
geom geometry(POINT, 4326),
CONSTRAINT pk_test PRIMARY KEY (id)
);
@mutolisp
mutolisp / 20201014_data_visualisation2.r
Created October 14, 2020 03:24
20201014_data_visualisation2.r
library(sp)
library(gstat)
library(raster)
graycol <- gray.colors(4, 0.55, 0.95)
# use IDW to generate zn.idw
data(meuse)
coordinates(meuse) <- c('x', 'y')
data(meuse.grid)
@mutolisp
mutolisp / dummy.csv
Last active October 13, 2020 14:39
Group calculation of R
mountain aspect species cover r
SEN W11 A 30 1
SEN W11 B 10 3
SEN W11 C 0.5 2
SEN W13 A 15 4
SEN W13 D 5 3
SEN W13 E 3 2
SEN W13 F 0.1 1
SEN W13 G 10 4
SUN E11 A 15 2
@mutolisp
mutolisp / twTransform.r
Created October 8, 2020 09:03
twTransfrom
# install sp package before use
# read coordinates csv
twTransform <- function(input = file.choose(), x='x', y='y' ,from = 'wgs84', to= 'twd97'){
require(sp)
coords <- read.csv(input, sep = ',')
coords <- cbind(coords[x], coords[y])
colnames(coords) <- c('x', 'y')
pts <- coordinates(coords)
# projection
wgs84 <- CRS('+proj=longlat +ellps=WGS84')
@mutolisp
mutolisp / retrieveCoords.R
Last active August 12, 2020 14:22
Using geocoding API to translate school address to coordinates
library(data.table)
library(jsonlite)
library(readxl)
library(curl)
# Get your API from GCP
API_KEY <- '&key=$YOUR_API_KEY'
URL <- 'https://maps.googleapis.com/maps/api/geocode/json?address='
# Data source:
# # Elementary high school: https://data.gov.tw/dataset/6087
# # Junior high school: https://data.gov.tw/dataset/6088
@mutolisp
mutolisp / query.sql
Created August 9, 2020 09:55
timescaleDB get time period
SELECT
time_bucket('1 day', timestamp) AS period,
summit,
direction,
avg(temperature),
max(temperature),
min(temperature)
FROM
temperature_hyper
WHERE
@mutolisp
mutolisp / seqParser_preinstall.r
Created June 8, 2020 07:39
seqParser pre-installation
# install required packages
requiredPkgs <- c("BiocManager", "seqinr", "data.table", "devtools")
for ( i in 1:length(requiredPkgs)){
if (!requireNamespace(requiredPkgs[i], quietly = TRUE))
install.packages(requiredPkgs[i])
}
BiocManager::install("Biostrings")
devtools::install_github(repo = 'mutolisp/seqParser')
@mutolisp
mutolisp / taicol_family.csv
Last active April 28, 2020 06:53
TaiCOL family
class family family_c
Hydrozoa Abylidae 多面水母科
Magnoliopsida Acanthaceae 爵床科
Asteroidea Acanthasteridae 長棘海星科
Anthozoa Acanthigorgiidae 棘柳珊瑚科
Gastropoda Acanthinulidae 菜種蝸牛科
Polyplacophora Acanthochitonidae 毛膚石鱉科
Trematoda Acanthocolpidae 棘體科
Insecta Acanthosomatidae 角蝽科(同蝽科)
Trematoda Acanthostomidae 棘盤科