Skip to content

Instantly share code, notes, and snippets.

View divmgl's full-sized avatar

Dexter Miguel divmgl

  • San Francisco, CA
  • 01:09 (UTC -04:00)
  • X @divmgl
View GitHub Profile
@divmgl
divmgl / llm-wiki.md
Created July 2, 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.

@divmgl
divmgl / vpc.js
Created February 22, 2022 14:12
Smitten VPC Arc Plugin
const aws = require("aws-sdk")
const iam = new aws.IAM()
const ec2 = new aws.EC2()
const securityGroupNames = [
"allow-internal-ingress",
"allow-internal-egress",
"allow-external-egress"
]
@divmgl
divmgl / perm_missing_elem.py
Created March 24, 2017 00:16
Codility.com PermMissingElem 100%/100%
def solution(A):
total = sum(A)
diff = sum(range(1, len(A) + 2))
return abs(diff - total)
@divmgl
divmgl / frogjmp.py
Created March 23, 2017 21:31
Codility.com FrogJmp 100%
import math
def solution(X, Y, D):
return int(math.ceil(float(Y - X) / float(D)))
@divmgl
divmgl / cyclicrotation.py
Created March 23, 2017 21:20
Codility.com CyclicRotation 100%
def solution(A, K):
if len(A) == 0:
return A
for _ in range(K):
A.insert(0, A.pop())
return A
@divmgl
divmgl / oddoccurrencesinarray.py
Last active March 23, 2017 21:11
Codility.com OddOccurrencesInArray 100%/100%
def solution(A):
table = dict()
for num in A:
if not table.get(num):
table[num] = 1
else:
table.pop(num)
return table.keys()[0]
@divmgl
divmgl / binarygap.py
Last active April 8, 2017 09:48
Codility.com BinaryGap 100%
def solution(N):
max = 0
bits = 0
bin = "{0:b}".format(N)
for c in bin:
if c == "0":
bits += 1
if c == "1":
if max < bits:
@divmgl
divmgl / binarygap.c
Created March 23, 2017 20:37
Codility.com BinaryGap 100% in C
long bits = 0;
long max = 0;
void binary(long N) {
if (N > 1) {
binary(N / 2);
}
if (N % 2 == 0) {
bits += 1;
return;
@divmgl
divmgl / random.cpp
Last active January 7, 2017 05:05
Weighted random function
#include <iostream>
#include <array>
#include <map>
#include <random>
using std::cout;
using std::endl;
using std::string;
using std::array;
@divmgl
divmgl / maxcounters.js
Created December 1, 2015 07:23
MaxCounters Javascript Solution 100%/100%
function solution(N, A) {
var M = A.length; // Length of the entry array
var C = []; // Counters
var H = 0; // Highest counter
var PH = 0; // Previously recorded highest counter
for(K = 0; K < N; K++) { // Initialize the array
C[K] = 0;
}