Skip to content

Instantly share code, notes, and snippets.

View allanj's full-sized avatar
🎯
Focusing

Allan Jie allanj

🎯
Focusing
View GitHub Profile
@allanj
allanj / llm-wiki.md
Created May 5, 2026 00:28 — 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.

@allanj
allanj / inspirational_quotes_app.py
Created July 23, 2025 16:03 — forked from CharlyWargnier/inspirational_quotes_app.py
A Streamlit app for navigating through inspirational quotes with "Next" and "Previous" buttons.
import streamlit as st
if 'count' not in st.session_state:
st.session_state.count = 0
if 'quotes' not in st.session_state:
st.session_state.quotes = [
"Life is what happens when you're busy making other plans. — John Lennon",
"Get busy living or get busy dying. — Stephen King",
"You only live once, but if you do it right, once is enough. — Mae West",
@allanj
allanj / client.py
Created December 23, 2024 04:05 — forked from youkaichao/client.py
client.py
import openai
import asyncio
async def get_choice_completion(prompt, choices):
# Initialize an asynchronous OpenAI client
async with openai.AsyncClient(base_url="http://127.0.0.1:8000/v1", api_key="abc") as client:
choice_probs = {}
# Calculate logprobs for each prompt + choice sequence
for choice in choices:
@allanj
allanj / Random Images on Refresh
Created June 15, 2020 16:19 — forked from stephenscaff/Random Images on Refresh
Super simple way to randomly load new images on refresh via Jquery and DOM injection. Great for banners.
<!DOCTYPE html>
<head>
<!--Little CSS fade in -->
<style>
.fade-in{
-webkit-animation: fade-in 2s ease;
-moz-animation: fade-in ease-in-out 2s both;
-ms-animation: fade-in ease-in-out 2s both;
-o-animation: fade-in ease-in-out 2s both;
@allanj
allanj / Install
Created June 5, 2020 05:48 — forked from ines/Install
Streamlit + spaCy
pip install streamlit
pip install spacy
python -m spacy download en_core_web_sm
python -m spacy download en_core_web_md
python -m spacy download de_core_news_sm
@allanj
allanj / memory.lua
Created October 24, 2017 08:10 — forked from vzhong/memory.lua
require 'nn'
require 'dpnn'
require 'rnn'
require 'nngraph'
local opt = {
n_seq = 3,
d_hid = 4,
d_mem = 20,
n_batch = 2,