Skip to content

Instantly share code, notes, and snippets.

View kmmbvnr's full-sized avatar
💭
#StopPutin #StopWar

Mikhail Podgurskiy kmmbvnr

💭
#StopPutin #StopWar
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.

"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
"use client";
// Import necessary utilities and components.
// tailwind-merge is used to intelligently merge Tailwind CSS classes, preventing conflicts.
import React from "react";
import { twMerge } from "tailwind-merge";
// useState is a React Hook for managing state within the component.
import { useState } from "react";
// Custom icon components for the sidebar.
@codingjoe
codingjoe / README.md
Last active April 29, 2026 22:08
Run MCP on Django w/o a headache

WSGI and ASGI on a single server

We want to attach a an ASGI app, like FastAPI, to an existing Django app, without any performance downsides.

In our example we are attaching an MCP server, including auto-loading.

Preparation

You have an existing Django app, you serve via WSGI on a server like guinicorn. That's it!

import React from "react";
// yea
import axios from "axios";
import {render} from "react-dom";
import {setStylesTarget} from "typestyle";
import {Provider} from "reactivated/context";
// nope
@gpulido
gpulido / autocomplete.component.html
Created March 1, 2020 12:47
mockup for a mdc autocomplete component
<div #surfaceAnchor mdcMenuSurfaceAnchor (click)="onClick($event)">
<ng-content (keydown)="onKeydown($event)" select="mdc-text-field"></ng-content>
<ng-content select="mdc-menu"></ng-content>
</div>
@tinkerology
tinkerology / RoundedCube.scad
Created February 17, 2020 05:56
Create a cube with rounded sides
$fn=60;
// Answer from: https://stackoverflow.com/users/1320888/cutetare
// https://stackoverflow.com/questions/33146741/way-to-round-edges-of-objects-openscad/33289349#33289349
module roundedcube(xx, yy, height, radius) {
difference(){
cube([xx,yy,height]);
@davidbegin
davidbegin / measure_memory.py
Created January 21, 2020 03:43
Measure Memory usage of functions with a decorator
# Stolen from: https://medium.com/survata-engineering-blog/monitoring-memory-usage-of-a-running-python-program-49f027e3d1ba
print("\33c")
import tracemalloc
def measure_memory(func):
tracemalloc.start()
@pirate
pirate / django_turbo_response.py
Last active November 21, 2022 21:12
An extended HTTPResponse class for Django 2.2 adding support for streaming partial template responses incrementally, preload headers, HTTP2 server push, CSP headers, running post-request callbacks, and more (fully typed).
"""
This is an extended HTTP response class for Django >=2.0 that adds lots of fancy features.
It's most useful when needing to accellerate slow view functions that return templates,
but it can be used anywhere where you need to return an HTTPResponse() or render(...).
It works by subclassing the builtin Django HttpResponse and StreamingHttpResponse,
and adding improvements in many areas, including functionality, speed, and security.
The most up-to-date version of this code can be found here:
@disintegrator
disintegrator / https-during-dev.macos.sh
Last active November 16, 2025 17:55
Use Caddy, mkcert and dnsmasq to expose your development server over HTTPS
brew install caddy mkcert nss dnsmasq
mkcert -install
mkcert '*.app.test' '*.cdn.test'
# rename the certs and move them under /usr/local/etc/caddy/certs
cat <<EOF > /usr/local/etc/caddy/Caddyfile
*.app.test:443, *.cdn.test:443 {