Skip to content

Instantly share code, notes, and snippets.

@sh1nj1
sh1nj1 / llm-wiki.md
Created July 20, 2026 05:57 — 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.

When I have fears that I may cease to code (2013)

I wrote this in December 2013, as a parody of Keats' sonnet "When I have fears that I may cease to be."

Rereading it now, the buzzwords it reaches for — spiders, the cloud, "social," crowdfunding — have quietly aged into a time capsule. I was afraid I'd never get to code. What happened instead is stranger: I stopped writing it myself. The fear came true, just not the way I'd braced for — the code still comes, I just don't type it anymore.

@sh1nj1
sh1nj1 / CONVENTIONS.md
Created February 19, 2025 03:05 — forked from peterc/CONVENTIONS.md
CONVENTIONS.md file for AI Rails 8 development
  • You MUST NOT try and generate a Rails app from scratch on your own by generating each file. For a NEW app you MUST use rails new first to generate all of the boilerplate files necessary.
  • Create an app in the current directory with rails new .
  • Use Tailwind CSS for styling. Use --css tailwind as an option on the rails new call to do this automatically.
  • Use Ruby 3.2+ and Rails 8.0+ practices.
  • Use the default Minitest approach for testing, do not use RSpec.
  • Default to using SQLite in development. rails new will do this automatically but take care if you write any custom SQL that it is SQLite compatible.
  • An app can be built with a devcontainer such as rails new myapp --devcontainer but only do this if requested directly.
  • Rails apps have a lot of directories to consider, such as app, config, db, etc.
  • Adhere to MVC conventions: singular model names (e.g., Product) map to plural tables (products); controllers are plural.
  • Guard against incapable browsers accessing controllers with `allo
@sh1nj1
sh1nj1 / pid-by-port.sh
Created July 19, 2023 02:22
Get PID by listening port number in Mac OS X
#!/bin/sh
lsof -nP -iTCP -sTCP:LISTEN | grep $1
@sh1nj1
sh1nj1 / git-push-all-remote-repositories.md
Last active April 14, 2023 03:29
git push all remote repositories
git remote add all REMOTE-URL-1
git remote set-url --add --push all REMOTE-URL-1
git remote set-url --add --push all REMOTE-URL-2
git push all BRANCH
@sh1nj1
sh1nj1 / gist:7066f0212817d45619bf70ee19cf9749
Created February 18, 2022 00:47
read-redisson-hash-by-redis-cli
redis-cli eval "return redis.call('hset', KEYS[1], KEYS[2], struct.pack('dLc0', 0.0, string.len(ARGV[1]), ARGV[1]))" 2 "test-map" "key1" '{"value":"hello world"}'
redis-cli eval "local value = redis.call('hget', KEYS[1], KEYS[2]); local t, val = struct.unpack('dLc0', value); return val;" 2 "test-map" "key1"
@sh1nj1
sh1nj1 / spring-security-config-for-api-key-auth.code
Created March 24, 2021 09:21
Spring security auth configuration for simple api-key header (Kotlin)
.addFilter(object: AbstractPreAuthenticatedProcessingFilter() {
override fun getPreAuthenticatedPrincipal(req: HttpServletRequest) = req.getHeader("X-API-KEY") ?: ""
override fun getPreAuthenticatedCredentials(req: HttpServletRequest) = ""
}.apply {
setAuthenticationManager {
it.isAuthenticated = it.principal == "{your-api-key}"
it
}
})
@sh1nj1
sh1nj1 / appcrush.rb
Last active March 14, 2017 05:18 — forked from zachwill/appcrush.rb
Extract images from iOS .ipa files
#!/usr/bin/ruby -rubygems
#
# Point appcrush at an .ipa file from the iTunes AppStore and it
# - expands the zip file
# - finds all the images
# - runs pngcrush with the revert-iphone-optimizations option on each image
#
# Requirements Xcode with iOS SDK 3.2 or higher
#
# Usage: appcrush '/Users/boctor/Music/iTunes/Mobile Applications/iBooks.ipa'
@sh1nj1
sh1nj1 / spark-spring-boot-pom.xml
Created March 18, 2016 00:23
Spark application with SpringBoot.
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>tv.anypoint</groupId>
<artifactId>spark-spring-boot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
@sh1nj1
sh1nj1 / spring-boot-exclude-jars
Created March 18, 2016 00:12
Exclude some jar files from package with spring-boot-gradle-plugin.
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")
}
apply plugin: 'spring-boot'
springBoot {
customConfiguration = 'runtime'
}