Skip to content

Instantly share code, notes, and snippets.

View leonhe's full-sized avatar
🏗️
Working from office

Leon He leonhe

🏗️
Working from office
View GitHub Profile
@leonhe
leonhe / llm-wiki.md
Created April 10, 2026 03:52 — 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.

Keybase proof

I hereby claim:

  • I am leonhe on github.
  • I am leon8 (https://keybase.io/leon8) on keybase.
  • I have a public key ASDtDfqKnfoT9Q5oGV1prg1i_NU7uYuRbCpGMnVam_09ago

To claim this, I am signing this object:

@leonhe
leonhe / gist:d956cb65c246f44193c249dc29275264
Last active November 1, 2018 02:57
Android px convert dp & dp convert px
/**
* 根据手机的分辨率从 dp 的单位 转成为 px(像素)
*/
public static int dip2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
/**
* 根据手机的分辨率从 px(像素) 的单位 转成为 dp
@leonhe
leonhe / omnifocus-capture.el
Created August 18, 2017 02:10 — forked from jrblevin/omnifocus-capture.el
Sending Tasks to OmniFocus from Emacs <http://jblevins.org/log/emacs-omnifocus>
;; Based on omnifocus-capture.el by Ken Case with the following original comment:
;;
;; To capture tasks from Emacs to OmniFocus using Control-C Control-O,
;; drop this script in your emacs load path and add lines like these to
;; your .emacs:
;;
;; (autoload 'send-region-to-omnifocus "omnifocus-capture" "Send region to OmniFocus" t)
;; (global-set-key (kbd "C-c C-o") 'send-region-to-omnifocus)
;;
;; The send-region-to-emacs function has been rewritten as follows:
@leonhe
leonhe / gist:ea6c3b21ddd66c47be3fa64d268d82ec
Last active August 25, 2016 10:28
Gradle Build project at XXX:transformClassesWithDexForDebug slow feature
android {
defaultConfig {
…..
multiDexEnabled true
…...
}
…………..
dexOptions {
preDexLibraries true
javaMaxHeapSize "2g" // Use gig increments depending on needs
@leonhe
leonhe / build.gradle
Created July 26, 2016 13:22
Android Studio build project copy frome resources to assets directory
buildTypes {
.................
task copyAssertRes(type: Copy){
from 'source directory'
into 'distance directory'
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn("copyAssertRes", ....)
}
....................