Skip to content

Instantly share code, notes, and snippets.

View cgpeter96's full-sized avatar
🙏
Everything is OK!

Peter Chan cgpeter96

🙏
Everything is OK!
  • China
View GitHub Profile
@cgpeter96
cgpeter96 / test.py
Created May 22, 2018 07:40
Hello word
print('Hello word!')
@cgpeter96
cgpeter96 / distutils.cfg
Created February 25, 2019 15:47
帮助安装pycocoapi
[build]
compiler=msvc
@cgpeter96
cgpeter96 / road_extraction.py
Created February 24, 2021 15:10
街道抽取脚本(简易版)
"""
@desc:
en:the simple code of road name extration
cn:简单街道抽取脚本
@author:peter
@mail:peter_chen_jaon@foxmail.com
@date:2021/2/24
@note:
该脚本可能存在问题,但由于目前数据就这么多所以就先这样吧,仅供参考。
"""
@cgpeter96
cgpeter96 / tokenization.cpp
Created February 3, 2023 09:15 — forked from luistung/tokenization.cpp
c++ version of bert tokenize
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <unordered_map>
#include <boost/algorithm/string.hpp>
#include <utf8proc.h>
//https://unicode.org/reports/tr15/#Norm_Forms
//https://ssl.icu-project.org/apiref/icu4c/uchar_8h.html
# train_grpo.py
from typing import *
import re
import torch
from datasets import load_dataset, Dataset, load_from_disk
from transformers import AutoTokenizer, AutoModelForCausalLM, TrainingArguments
from peft import LoraConfig
from trl import GRPOConfig, GRPOTrainer, TrlParser
from dataclasses import dataclass, field
@cgpeter96
cgpeter96 / extract-sourcemap.mjs
Created March 31, 2026 09:27 — forked from sorrycc/extract-sourcemap.mjs
Extract original source code from JavaScript .map (source map) files. Reads sourcesContent, skips node_modules, reconstructs the original file tree.
#!/usr/bin/env node
/**
* Extract original source code from a JavaScript source map file.
*
* Usage:
* node extract-sourcemap.mjs <path-to-.map-file> [output-dir]
*
* Example:
* node extract-sourcemap.mjs cli.js.map ./src-extracted
@cgpeter96
cgpeter96 / llm-wiki.md
Created April 9, 2026 16:08 — 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.