Skip to content

Instantly share code, notes, and snippets.

View richarddun's full-sized avatar
♉
Always onward, however slow, failure's delay will pass and go.

Richard D richarddun

♉
Always onward, however slow, failure's delay will pass and go.
View GitHub Profile
@richarddun
richarddun / markdown_chunker.py
Last active September 15, 2026 22:35
A simple, token aware markdown file chunker (supports multiple .md files in a folder) written in python.
import os
import json
import sys
import argparse
import re
import subprocess
import uuid
from dataclasses import dataclass, asdict, field
from pathlib import Path
from hashlib import md5
@richarddun
richarddun / gist:a24bd0b603c549c8428a4f7df245cc56
Created August 22, 2026 08:59
lyria-3 integration script
#!/usr/bin/env python3
"""Generate music via OpenRouter using google/lyria-3-pro-preview. # forked from https://github.com/Mustard5/music_generation/blob/main/skills/music-generation/scripts/lyria-gen.py
"""
import argparse
import base64
import json
import os
import sys
import wave
@richarddun
richarddun / Codex-Profiles-Termux.md
Last active May 8, 2026 19:57
Run OpenAI Codex on Termux (Android) with OpenRouter + Dynamic Model Launcher (Grok, Claude, GPT-5, Gemini)

Run OpenAI Codex on Termux (Android) with OpenRouter + Dynamic Model Launcher

Grok • Claude Opus • GPT-5 • Gemini • MiniMax • ANY OpenRouter Model

This guide shows you how to install and run OpenAI’s Codex CLI inside Termux on Android, using the DioNanos/codex-termux fork (bionic-compatible), with full support for:

  • Shell tool execution
  • OpenRouter models (Grok, Claude Opus, GPT-5, Gemini, etc.)
  • A dynamic fzf launcher that auto-detects all [profiles.*] in your Codex config
  • Clean .env-based secret handling
  • Automatic model switching
@richarddun
richarddun / img_vary.py
Created July 6, 2023 14:08
Sample python script to take an image as input and send to dall-e 2 from cli
# This Python file uses the following encoding: utf-8
import openai
import requests
import sys
from PIL import Image
from uuid import uuid4
import os
image_to_vary = sys.argv[1]
try:
@richarddun
richarddun / img_gen.py
Created July 6, 2023 14:03
Basic OpenAI image gen (Dall-e 2) from cli using python
# This Python file uses the following encoding: utf-8
import openai
import requests
import sys
from PIL import Image
# sample usage of Dalle-2 via Python
# from CLI with sys for args
variations = 4
@richarddun
richarddun / aiohttp_sample
Last active September 1, 2017 19:24
Sample usage of aiohttp to post arbitary data and return / use the result in original order with asyncio.gather()
import asyncio
import aiohttp
import json
async def retrieve_data(postdata):
async with aiohttp.ClientSession() as client:
#use the excellent httpbin.org as a springboard
postrep = await client.post('http://httpbin.org/post',data={"postkey":postdata})
jsonobj = json.loads(await postrep.text())
return jsonobj['form']['postkey']
@richarddun
richarddun / gist:1bb11d32cafc394efbcb8f4a8b6cb130
Last active January 30, 2025 19:33
scapy script to send http requests
#!/usr/bin/env python
"""
Script to open TCP connection and send 1 HTTP GET request containing
a specific string, and header
Usage:
./http.py <IP_of_target>
There is only one mandatory argument, which is the target IP address.
#!/usr/bin/env python2
import curses
import curses.panel
def main(win):
global stdscr
global max_y,max_x,mult
stdscr = win
curses.initscr()