Skip to content

Instantly share code, notes, and snippets.

@am17an
am17an / mtp-bench.py
Last active May 13, 2026 15:20
MTP benchmark
#!/usr/bin/env python3
import argparse, json, sys, time
from urllib import request
PROMPTS = [
{"name": "code_python", "prompt": "Write a Python function that returns the n-th Fibonacci number using memoization. Include a docstring."},
{"name": "code_cpp", "prompt": "Write a C++ template function `clamp(x, lo, hi)` that returns x clamped to [lo, hi]. No std::clamp."},
{"name": "explain_concept", "prompt": "Explain how speculative decoding works in large language model inference, in three short paragraphs."},
{"name": "summarize", "prompt": "Summarize in two sentences: The Industrial Revolution began in Britain in the late 18th century, transforming manufacturing through mechanization, steam power, and the factory system. It spread to continental Europe and North America during the 19th century."},
{"name": "qa_factual", "prompt": "Q: What are the four fundamental forces of physics?\nA:"},

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.

@N8python
N8python / simplesearch.js
Last active July 10, 2024 20:20
It's pretty simple to make a half-decent search agent.
import googleIt from 'google-it';
import axios from 'axios';
import cheerio from 'cheerio';
import OpenAI from 'openai';
import readlineSync from 'readline-sync';
const openai = new OpenAI({
baseURL: "http://localhost:1234/v1",
apiKey: 'My API Key'
});
@nxrighthere
nxrighthere / Unreal-AgX-Tonemapper.usf
Last active May 13, 2026 09:59
AgX tonemapping for Unreal Engine 5
// See image comparison https://imgur.com/a/9L2P7GJ
// Read details https://iolite-engine.com/blog_posts/minimal_agx_implementation
// Usage:
// 1. Open "Project Settings" and change "Working Color Space" to "sRGB / Rec709"
// 2. Open `Engine\Shaders\Private\PostProcessTonemap.usf` file
// 3. Find `half3 OutDeviceColor = ColorLookupTable(FinalLinearColor);` line
// 4. Replace it with `half3 OutDeviceColor = ApplyAgX(FinalLinearColor);` line
// 5. Find `half3 ColorLookupTable( half3 LinearColor )` function
// 6. After the scope of the function, add the code below and run `RecompileShaders Changed` from console
@Maximilian-Winter
Maximilian-Winter / gbnf_grammar_generator.py
Last active November 17, 2024 06:13
GBNF grammar generator for always valid function calls and object creation in JSON with llama.cpp
import inspect
import json
import re
import typing
from inspect import isclass, getdoc
from types import NoneType
from pydantic import BaseModel, Field
from pydantic.fields import FieldInfo
from typing import Any, Type, List, get_args, get_origin, Tuple, Union, Optional
@Hellisotherpeople
Hellisotherpeople / blog.md
Last active April 5, 2026 08:28
You probably don't know how to do Prompt Engineering, let me educate you.

You probably don't know how to do Prompt Engineering

(This post could also be titled "Features missing from most LLM front-ends that should exist")

Apologies for the snarky title, but there has been a huge amount of discussion around so called "Prompt Engineering" these past few months on all kinds of platforms. Much of it is coming from individuals who are peddling around an awful lot of "Prompting" and very little "Engineering".

Most of these discussions are little more than users finding that writing more creative and complicated prompts can help them solve a task that a more simple prompt was unable to help with. I claim this is not Prompt Engineering. This is not to say that crafting good prompts is not a difficult task, but it does not involve doing any kind of sophisticated modifications to general "template" of a prompt.

Others, who I think do deserve to call themselves "Prompt Engineers" (and an awful lot more than that), have been writing about and utilizing the rich new eco-system

@binji
binji / notes.md
Created November 25, 2022 05:14
Compiling LLVM/Clang for Wasm notes
  • How to Cross Compile LLVM: https://llvm.org/docs/HowToCrossCompileLLVM.html
  • Building LLVM with CMake: https://llvm.org/docs/CMake.html
  • Hints from wasi-sdk Makefile: https://github.com/CraneStation/wasi-sdk/blob/master/Makefile
  • Try compiling natively (needed for llvm-tblgen and clang-tblgen)
    • cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;WebAssembly" -DLLVM_ENABLE_PROJECTS="lld;clang" ../llvm
  • Try building LLVM with WASI:
  • cmake -G Ninja -DCMAKE_AR=”/usr/local/google/home/binji/dev/llvm-project/build/bin/llvm-ar” -DCMAKE_RANLIB=”/usr/local/google/home/binji/dev/llvm-project/build/bin/llvm-ranlib” -DCMAKE_C_COMPILER="/usr/local/google/home/binji/dev/wasi-sdk-5.0/opt/wasi-sdk/bin/clang" -DCMAKE_CXX_COMPILER="/usr/local/google/home/binji/dev/wasi-sdk-5.0/opt/wasi-sdk/bin/clang++" -DCMAKE_CROSSCOMPILING=True -DCMAKE_INSTALL_PREFIX=/usr/local/google/home/binji/dev/wasi-clang -DLLVM_TABLEGEN=/usr/local/google/home/binji/dev/llvm-project/build/bin/llvm-tblgen -DCLANG_TABLEGEN=/
@carlopi
carlopi / cheerp_jit.cpp
Created March 21, 2021 19:47
Skeleton of Jit implementation with Cheerp
namespace [[cheerp::genericjs]] client {
//forward declare a bunch of JavaScript APIs existing on the browser
namespace WebAssembly {
public:
Promise* instantiate(ArrayBuffer* code, ImportObject* imports);
};
}
[[cheerp::genericjs]] void onSuccess(ModuleAndInstance* res) {
auto start_function = res->get_instance()->get_start_function();
/// <reference path="../../typings/ue.d.ts">/>
@UCLASS(BlueprintComponent)
class MyCharacter extends Character {
@UPROPERTY(EditAnywhere)
CameraBoom: SpringArmComponent;
@UPROPERTY(EditAnywhere)
FollowCamera: CameraComponent;
@electron0zero
electron0zero / README.md
Last active June 14, 2025 01:45
TP-Link AC600 Archer T2U Nano - Ubuntu 18.04 - Info and drivers