Skip to content

Instantly share code, notes, and snippets.

View richardschoen's full-sized avatar

Richard Schoen richardschoen

View GitHub Profile
@richardschoen
richardschoen / llm-wiki.md
Created April 5, 2026 14:13 — 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.

/***********************************************************************************/
/* Look at files taking up space in IFS */
/* */
/* Returns similar information to RTVDIRINF, but at the (relative) speed of light! */
/***********************************************************************************/
-- Get raw info about files from IFS_OBJECT_STATISTICS
WITH ALL_OBJS AS (
SELECT PATH_NAME,
OBJECT_TYPE,
/**************************************************************************************/
/* Track temporary storage usage with QSYS2.SYSTEM_STATUS and QSYS2.SYSTMPSTG */
/**************************************************************************************/
-- Create schema for function and detail file creation.
CREATE SCHEMA TMPSTGMON;
-- Information as presented by Navigator
SELECT SYSTEM_ASP_STORAGE,
CURRENT_TEMPORARY_STORAGE,
@richardschoen
richardschoen / IFSAuditAndSystemLimits.sql
Created March 24, 2026 13:49 — forked from ryan-moeller21/IFSAuditAndSystemLimits.sql
Using System Limits and Audit Journals to Investigate IFS Usage
/*************************************************************/
/* Use system limits to find users abusing IFS space */
/*************************************************************/
-- Look at all users who have triggered system limits in the last 24 hours...
SELECT *
FROM QSYS2.SYSLIMITS
WHERE LAST_CHANGE_TIMESTAMP > CURRENT TIMESTAMP - 1 DAY
AND USER_NAME != 'QSYS'
ORDER BY LAST_CHANGE_TIMESTAMP DESC;
@richardschoen
richardschoen / SystemCurrencyStatus.sql
Created March 24, 2026 13:49 — forked from ryan-moeller21/SystemCurrencyStatus.sql
SYSTEM_CURRENCY_STATUS -- Combining GROUP_PTF_CURRENCY, DEFECTIVE_PTF_CURRENCY, and FIRMWARE_CURRENCY
/************************************************************************************************************/
/* Check for defective PTFs, new PTF groups, and firmware updates. Email someone a spreadsheet the results! */
/************************************************************************************************************/
CREATE OR REPLACE FUNCTION SYSTOOLS.SYSTEM_CURRENCY_STATUS (
EMAIL VARCHAR(100)
)
RETURNS INT
SPECIFIC SYSTOOLS.SYSCURSTS
MODIFIES SQL DATA
LANGUAGE SQL
/******************************************************************************/
/* Find security-related changes made by potentially vulnerable user profiles */
/******************************************************************************/
-- Navigator's Users Tab
SELECT
CASE GROUP_ID_NUMBER
WHEN 0 THEN 'USER'
ELSE 'GROUP'
END AS PROFILE_TYPE,
@richardschoen
richardschoen / JournalReceiverCleanup.SQL
Created March 24, 2026 13:49 — forked from ryan-moeller21/JournalReceiverCleanup.SQL
Cleaning Up Old, Unsaved Journal Receivers
/*************************************************************************************************/
/* Manage consumption of storage by journal receivers, only keep last N days of journals */
/*************************************************************************************************/
SELECT *
FROM QSYS2.JOURNAL_RECEIVER_INFO
WHERE DETACH_TIMESTAMP < CURRENT DATE - 3 DAYS;
-- NOTE: *IGNINQMSG is not specified for DLTJRNRCV. Any unsaved journals receivers will not be deleted.
CREATE OR REPLACE FUNCTION SYSTOOLS.DELETE_OLD_RECEIVERS (
CREATE OR REPLACE FUNCTION SYSTOOLS.FIND_OPEN_COMMIT_CYCLES(
JOURNAL_NAME VARCHAR(10) DEFAULT '*ALL',
JOURNAL_LIBRARY VARCHAR(10) DEFAULT '*ALL',
IASP_NUMBER INT DEFAULT 0
)
RETURNS TABLE (
JOURNAL_RECEIVER_LIBRARY VARCHAR(10),
JOURNAL_RECEIVER_NAME VARCHAR(10),
JOURNAL_LIBRARY VARCHAR(10),
JOURNAL_NAME VARCHAR(10),
@richardschoen
richardschoen / GettingStartedWithFunctions.sql
Created March 24, 2026 13:48 — forked from ryan-moeller21/GettingStartedWithFunctions.sql
Getting Started with SQL Functions and Procedures
/*************************************************************************************************/
/* The goal of this SQL script is to demonstrate various features of SQL PL. This will include */
/* loops, error handling, parameters, cursor management, returning of result sets, and more. */
/* The topic of this script will revolve around the management (deletion) of journal receivers. */
/* */
/* Created for Common POWERUp 2024 */
/* Session: Getting Started with SQL Functions and Procedures */
/* Author: Ryan Moeller (rmoeller@ibm.com) */
/* Date: May 2024 */
/*************************************************************************************************/
@richardschoen
richardschoen / SystemAndStorageManagement.sql
Created March 24, 2026 13:48 — forked from ryan-moeller21/SystemAndStorageManagement.sql
SQL for System and Storage Management
/*************************************************************/
/* Use system limits to find users abusing IFS space */
/*************************************************************/
-- Look at all users who have triggered system limits in the last 24 hours...
SELECT *
FROM QSYS2.SYSLIMITS
WHERE LAST_CHANGE_TIMESTAMP > CURRENT TIMESTAMP - 1 DAY
AND USER_NAME != 'QSYS'
ORDER BY LAST_CHANGE_TIMESTAMP DESC;