Skip to content

Instantly share code, notes, and snippets.

View Tuhin-thinks's full-sized avatar
🏅
Learning

Tuhin Mitra Tuhin-thinks

🏅
Learning
View GitHub Profile
@Tuhin-thinks
Tuhin-thinks / llm-wiki.md
Created April 10, 2026 08:00 — 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.

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.

@Tuhin-thinks
Tuhin-thinks / print_format_list.py
Last active March 9, 2024 17:53
Function to print header along with list of list in tabular format.
import re
def print_formatted(_header, _items, padding=10, alignment="^"):
"""
Function to print header along with list of list in tabular format.
:param alignment: ^ -center alignment; < -left alignment; > -right alignment
:param _header: header strings for the table
:param _items: list of list, representing collection of rows
:param padding: padding count
@JavaScriptDude
JavaScriptDude / SingleInstanceChecker.py
Last active December 8, 2025 22:12
Cross Platform Example of Single Instance Checking in Python
import time, sys, os
class SingleInstanceChecker:
def __init__(self, id):
if isWin():
ensure_win32api()
self.mutexname = id
self.lock = win32event.CreateMutex(None, False, self.mutexname)
self.running = (win32api.GetLastError() == winerror.ERROR_ALREADY_EXISTS)
import sys
import time
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5 import QtCore
from PyQt5.QtCore import Qt
var = 0
f = ""
choiceStr = ""
@BlueNexus
BlueNexus / python2pseudo.py
Last active December 8, 2025 14:51
Python to Pseudocode converter
import os.path
import re
'''
INSTRUCTIONS
1. Create a file with the following code
2. Put the file you want to convert into the same folder as it, and rename it to "py_file.py"
3. Add a "#F" comment to any lines in the code which have a function call that doesn't assign anything (so no =),
as the program cannot handle these convincingly
4. Run the converter file
@badocelot
badocelot / damlevdist.py
Last active September 8, 2023 00:13
Damerau-Levenshtein edit distance calculator in Python. Based on pseudocode from Wikipedia: <https://en.wikipedia.org/wiki/Damerau-Levenshtein_distance>
# Damerau-Levenshtein edit distance implementation
# Based on pseudocode from Wikipedia: https://en.wikipedia.org/wiki/Damerau-Levenshtein_distance
def damerau_levenshtein_distance(a, b):
# "Infinity" -- greater than maximum possible edit distance
# Used to prevent transpositions for first characters
INF = len(a) + len(b)
# Matrix: (M + 2) x (N + 2)
matrix = [[INF for n in xrange(len(b) + 2)]]