Skip to content

Instantly share code, notes, and snippets.

View danielsdesk's full-sized avatar

danielsdesk danielsdesk

View GitHub Profile

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.

@pguso
pguso / rag-from-scratch.md
Last active November 15, 2025 18:27
Building "RAG from Scratch" in plain JavaScript. Feedback on repo structure?

RAG from Scratch

Demystify Retrieval-Augmented Generation (RAG) by building it yourself - step by step.
No black boxes. No cloud APIs. Just clear explanations, simple examples, and local code you fully understand.

This project follows the same philosophy as AI Agents from Scratch:
make advanced AI concepts approachable for developers through minimal, well-explained, real code.


@ScriptedAlchemy
ScriptedAlchemy / intput.js
Created June 4, 2025 06:39
Tree shake macro results
// Utility functions that would only be used by newFeature
function formatMessage(message) {
return `[NEW] ${message}`;
}
function validateFeature() {
return true;
}
function logFeatureUsage(featureName) {

State of Async WASI in Rust

Let me share what I've learned about implementing async WASIp2 components in Rust. My goal is to get the entire Tokio ecosystem working together seamlessly. This isn't a complete test of the ecosystem - some things might be simpler than we expect. Check out dicej's wasi-socket-tests repository for examples.

The first obstacle: you'll need a nightly version of Rust. Without it, you'll need major ecosystem changes to avoid the wasip2 module in the Rust standard library and use wasi crates for the necessary functionality.

Let's walk through the steps to get Reqwest working with Tokio.

Socket2

import { assign, setup } from "xstate";
type Context = {
chunks: Blob[];
mediaRecorder?: MediaRecorder;
submit: (contents: { file: File }) => void;
};
type Events =
| {
@vatsalsaglani
vatsalsaglani / mistral_ctx.py
Last active June 3, 2025 20:06
Token counting and message token management for MistralAI
from typing import List, Dict, Literal, Union
from transformers import AutoTokenizer
class MistralAICtx:
def __init__(self, model_name: str):
assert "mistral" in model_name, "MistralCtx only available for Mistral models"
self.tokenizer = AutoTokenizer.from_pretrained(
"mistralai/Mistral-7B-Instruct-v0.2")
@frozenpandaman
frozenpandaman / widevine-decryption.md
Last active June 7, 2026 01:11
download videos protected with widevine DRM
@steveruizok
steveruizok / visibility-polygon.ts
Created November 21, 2022 23:49
Get a visibility polygon (for shadow casting).
// segments are all of the segments in all of the shapes in the scene
// point is light point
// viewport is top left, top right, bottom right, bottom left
function getVisibilityPolygon(segments: Segment[], point: Point, viewport: Point[]) {
const brokenSegments: Segment[] = []
const viewportMinCorner = viewport[0]
const viewportMaxCorner = viewport[2]
@muzzol
muzzol / SD_x11vnc-install.sh
Last active December 5, 2023 09:52
script for installing x11vnc on Steam Deck
#!/bin/bash
# script for installing x11vnc on Steam Deck
# ATENTION: USE IT AT YOUR OWN RISK!!!!
#
# this will modify root filesystem so it will probably get
# overwrite on system updates but is totally ok executing
# it several times, so if something stops working just
# launch it again
#
@steveruizok
steveruizok / Player.js
Last active March 14, 2022 23:50
TypeScript declarations for Warrior.js. (mostly complete)
class Player {
/**
* @param {Warrior} warrior
*/
playTurn(warrior) {
warrior.walk()
}
}