Skip to content

Instantly share code, notes, and snippets.

View riveranb's full-sized avatar

River Wang riveranb

View GitHub Profile
@riveranb
riveranb / llm-wiki.md
Created April 7, 2026 14:30 — 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.

@riveranb
riveranb / UnityPutFile
Created July 30, 2019 07:36
C# UnityWebRequest "PUT" upload file
public static IEnumerator PuttingFile(string url, string srcpath, WebRequestTask task)
{
task.Reset();
task.Comments = "Upload File: " + srcpath;
yield return new WaitForEndOfFrame();
using (var www = new UnityWebRequest(url, UnityWebRequest.kHttpVerbPUT))
{
www.uploadHandler = new UploadHandlerFile(srcpath);
www.SetRequestHeader(_headerContentType, _contenttypeTextPlain);
@riveranb
riveranb / UnityGetFile
Created July 30, 2019 04:59
C# UnityWebRequest uses "GET" to get file
public static IEnumerator GettingFile(string url, string dstpath, WebRequestTask task)
{
task.Reset();
task.Comments = "Download File: " + dstpath;
yield return new WaitForEndOfFrame();
using (var uwr = new UnityWebRequest(url, UnityWebRequest.kHttpVerbGET))
{
uwr.downloadHandler = new DownloadHandlerFile(dstpath);
#if DEBUG
@riveranb
riveranb / InternetCheck.cs
Last active July 6, 2019 12:07
C# check for internet connection
// API doc for "WWW": https://docs.unity3d.com/ScriptReference/WWW.html
public static IEnumerator InternetConnectTrying(Action<bool> action, float secs = 1)
{
WWW www = new WWW("https://www.google.com");
yield return www;
yield return new WaitForSeconds(secs);
if (www.error != null)
@riveranb
riveranb / HttpTime.cs
Created July 6, 2019 05:02
C# check HTTP time
// https://stackoverflow.com/questions/6435099/how-to-get-datetime-from-the-internet
public static DateTime GetNetworkTimeHttp()
{
try
{
using (var response = WebRequest.Create("http://www.google.com").GetResponse()) // or any sites else
{
return DateTime.ParseExact(response.Headers["date"],
"ddd, dd MMM yyyy HH:mm:ss 'GMT'",
CultureInfo.InvariantCulture.DateTimeFormat,
@riveranb
riveranb / NtpTimeUdp.cs
Last active July 6, 2019 05:11
C# check time on internet with UDP
// https://stackoverflow.com/questions/1193955/how-to-query-an-ntp-server-using-c
public static DateTime GetNetworkTimeUdp()
{
// default Windows time server
const string ntpServer = "time.google.com"; // "time.windows.com" ...
// NTP message size - 16 bytes of the digest (RFC 2030)
var ntpData = new byte[48];
// Setting the Leap Indicator, Version Number and Mode values