Skip to content

Instantly share code, notes, and snippets.

@a-n-d-a-i
a-n-d-a-i / agent.py
Created June 7, 2026 02:11
agent in 50 lines
import os
import json
import re
import subprocess
import urllib.request as req
import urllib.error
from urllib.parse import urlencode
# ---------------------------------------------------------------------------
# web.py (inlined)
@a-n-d-a-i
a-n-d-a-i / reflect.py
Last active March 21, 2026 20:16
structured assumption testing exercise
questions = [
"What's on your mind?",
"Clearly define the main terms in your statement.",
"Clarify the assumptions underlying each point.",
]
def input_multi(prompt):
print(prompt, end='')
x = ''
while True:
@a-n-d-a-i
a-n-d-a-i / index.ts
Created February 7, 2026 08:32
AI Agent in Telegram
#!/usr/bin/env node
// USAGE: Just talk normally to Claude/Codex
// say reset to reset chat
// Start message with $ to run shell commands, e.g. $date
const USE_CLAUDE = true; // false -> use Codex
const ALLOWED_CHAT_IDS = [Number(process.env.MY_TG_CHAT_ID)];
const os = require('os');
@a-n-d-a-i
a-n-d-a-i / gpt.py
Created November 7, 2025 03:39
chatgpt in 50 lines of Python
import os
import sys
import json
import urllib
from urllib.request import Request, urlopen
from urllib.error import HTTPError
model='gpt-5-mini'
OPENAI_API_KEY = os.getenv('OPENAI_API_KEY')
@a-n-d-a-i
a-n-d-a-i / index.html
Created October 14, 2024 21:20
get youtube thumbnail
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>title</title>
</head>
<body>
<input type="text" />
<br>
<img/>
// edit: only convert if not already txt...
if (filepath.Ext(inputPath)) != ".txt" {
// Create a temporary file for the intermediate output
tmpFile, err := os.CreateTemp("", "ebook-convert-*.txt")
if err != nil {
return nil, fmt.Errorf("failed to create temporary file: %v", err)
}
defer tmpFile.Close()
@a-n-d-a-i
a-n-d-a-i / sethbling_mario.lua
Created October 12, 2024 10:06
SethBling's Mari/o (Backup)
-- MarI/O by SethBling
-- Feel free to use this code, but please do not redistribute it.
-- Intended for use with the BizHawk emulator and Super Mario World or Super Mario Bros. ROM.
-- For SMW, make sure you have a save state named "DP1.state" at the beginning of a level,
-- and put a copy in both the Lua folder and the root directory of BizHawk.
if gameinfo.getromname() == "Super Mario World (USA)" then
Filename = "DP1.state"
ButtonNames = {
"A",
@a-n-d-a-i
a-n-d-a-i / main.rs
Created June 14, 2024 00:45
rust runtime overflow
use macroquad::prelude::*;
#[macroquad::main("BasicShapes")]
async fn main() {
rand::srand(macroquad::miniquad::date::now() as _);
let w = 400;
let h = 400;
@a-n-d-a-i
a-n-d-a-i / pi.cpp
Created June 13, 2024 23:51
pi fraction finder
#include <stdio.h>
#include <math.h>
#include <float.h>
int main() {
const double PI = 3.141592653589793;
double m = 1;
double n = 1;
// double max_m = 10000;
// double max_n = 10000;
const w4 = @import("wasm4.zig");
// actual render resolution
const SCREEN_SIZE = w4.SCREEN_SIZE;
// game resolution (everything is rendered 2x)
// const SCREEN_WIDTH = 48*2;
const SCREEN_WIDTH = 96;
const SCREEN_HEIGHT = SCREEN_SIZE;