Skip to content

Instantly share code, notes, and snippets.

View farawayboat's full-sized avatar
🎯
Focusing

Vincent Yuan farawayboat

🎯
Focusing
View GitHub Profile
@farawayboat
farawayboat / llm-wiki.md
Created April 13, 2026 06:35 — 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.

# luna_pinyin_simp.custom.yaml
patch:
engine/translators:
- punct_translator
- r10n_translator
- reverse_lookup_translator
recognizer/patterns/reverse_lookup: "`[a-z]*$"
schema/dependencies:
- emoji
% Manual of pgf-umlsd.sty, a convenient set of macros for drawing UML
% sequence diagrams.
% Written by Xu Yuan <xuyuan.cn@gmail.com> from
% Southeast University, China.
% This file is part of pgf-umlsd
% you may get it at http://code.google.com/p/pgf-umlsd/
\documentclass{article}
\usepackage[margin=12mm]{geometry}
\usepackage{hyperref}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% 符合 GB/T 7714-2005 规范的 BibTeX 样式文件
%
% 作者: 胡海星 南京大学计算机科学与技术系
% 版本: v2.0.0 2013年10月18日
% 项目主页: http://haixing-hu.github.io/nju-thesis/
%
% 参考资料:
% [1] 中国国家标准化管理委员会. GB/T 7714-2005 文后参考文献着录规则[S]. 2005.
@farawayboat
farawayboat / combinations.py
Created November 5, 2013 09:04
使用递归生成组合数.
def combinations(iterable, r):
pool = tuple(iterable)
n = len(pool)
if r > n:
return
def comb_core(n, r):
for i in reversed(range(r - 1, n)):
if (r == 1):
yield (i, )
>>> x = {
        'a':1,
        'b':2,
        'c':{
            'aa':11,
            'bb':22,
            'cc':{
                'aaa':111
            }

}

@farawayboat
farawayboat / Y cominator.py
Created August 12, 2012 11:44
Implementation of the fixed point combinator Y
'''
Implementation of the fixed point combinator Y.
-----------------------------------------------
The Y combinator is a higher order function that suffices following relation:
Y(F) = F(Y(F))
From the fixed point property we can get an idea on how to implement a recursive
anonymous function.
@farawayboat
farawayboat / pandoc.template.zh.tex
Created August 12, 2012 08:40
Chinese LaTeX template (using Ctex) for pandoc.
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$]{$documentclass$}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{euler}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
% use microtype if available
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\IfFileExists{microtype.sty}{\usepackage{microtype}}{}