Skip to content

Instantly share code, notes, and snippets.

View AlmostEfficient's full-sized avatar

Raza AlmostEfficient

View GitHub Profile

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.

const preparePaymentIntent = async (amount: string, recipientAddress: string) => {
if (!smartAccount) {
throw new Error('No smart account found. Create one first.');
}
if (!isValidSolanaAddress(recipientAddress)) {
throw new Error('Invalid recipient address');
}
try {
import React, { createContext, useContext, useEffect, useState } from 'react';
import { GridSmartAccount, GridKyc, gridService } from '../grid';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { usdcToBaseUnits, usdcFromBaseUnits, formatUSDC, isValidSolanaAddress } from '../../utils/helpers';
import { useTurnkey } from './TurnkeyContext';
import { useTurnkey as useTurnkeySDK, TurnkeyClient, PasskeyStamper } from '@turnkey/sdk-react-native';
import { useAuth } from './useAuth';
import { walletsApi } from '../wallets';
import { isDev } from '../app';
import { TURNKEY_CONFIG } from '../constants';
@AlmostEfficient
AlmostEfficient / turnkey.service.js
Last active April 20, 2025 11:42
express server service to create and fetch turnkey solana wallets
import { Turnkey } from '@turnkey/sdk-server';
import { logger } from '../utils/logger.js';
import fetch from 'node-fetch';
const turnkey = new Turnkey({
apiBaseUrl: process.env.TURNKEY_API_BASE_URL || 'https://api.turnkey.com',
apiPrivateKey: process.env.TURNKEY_API_PRIVATE_KEY,
apiPublicKey: process.env.TURNKEY_API_PUBLIC_KEY,
defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID,
});
@AlmostEfficient
AlmostEfficient / index.ts
Created March 19, 2025 06:45
Create a non-custodial Solana wallet on Turnkey with a Supabase edge function
import { serve } from "https://deno.land/[email protected]/http/server.ts";
import { Turnkey } from "npm:@turnkey/sdk-server";
import { corsHeaders } from "../_shared/cors.ts";
const turnkey = new Turnkey({
apiBaseUrl: "https://api.turnkey.com",
apiPrivateKey: Deno.env.get("TURNKEY_API_PRIVATE_KEY")!,
apiPublicKey: Deno.env.get("TURNKEY_API_PUBLIC_KEY")!,
defaultOrganizationId: Deno.env.get("TURNKEY_ORGANIZATION_ID")!,
});
@AlmostEfficient
AlmostEfficient / solana-hooks.tsx
Created January 20, 2025 23:24
various hooks for solana actions
import {TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID} from '@solana/spl-token'
import {useConnection, useWallet, WalletContextState} from '@solana/wallet-adapter-react'
import {
Connection,
LAMPORTS_PER_SOL,
PublicKey,
SystemProgram,
TransactionMessage,
TransactionSignature,
VersionedTransaction,
@AlmostEfficient
AlmostEfficient / cli-sdk-quickstart.md
Last active March 4, 2025 08:01
Solana quickstart guides

title: "CLI & SDK quickstart" description: "This quickstart guide will show you how to use the CLI and the SDK to send SOL." keywords:

  • solana cli send transaction
  • send SOL using SDK
  • transfer SOL using CLI
  • set up Solana Javascript SDK
@AlmostEfficient
AlmostEfficient / load.js
Last active April 28, 2024 09:31
Load a Solana keypair from a .env file as a byte array
// "@solana/web3.js": "^1.87.6",
import { Connection, Keypair, clusterApiUrl } from '@solana/web3.js';
import dotenv from 'dotenv';
dotenv.config();
const connection = new Connection(clusterApiUrl('devnet'), 'confirmed');
const payerSecretKey = JSON.parse(process.env.PAYER);
const payer = Keypair.fromSecretKey(Uint8Array.from(payerSecretKey));
@AlmostEfficient
AlmostEfficient / loud.py
Created November 2, 2023 09:47
Getting too loud? This script will tell you
import pyaudio
import numpy as np
import os
import time
import ctypes
from colorama import Fore, Back, init
# Initialize colorama
init(autoreset=True)
@AlmostEfficient
AlmostEfficient / lib.rs
Created July 6, 2023 11:36
Simple native Solana Rust program that echoes back whatever message you send it.
use solana_program::{
account_info::{AccountInfo},
entrypoint,
entrypoint::ProgramResult,
msg,
pubkey::Pubkey,
};
entrypoint!(process_instruction);