Skip to content

Instantly share code, notes, and snippets.

View tommyjtl's full-sized avatar

Tommy tommyjtl

View GitHub Profile
@tommyjtl
tommyjtl / README.md
Created October 28, 2026 17:29
~30-line minimal coding agent on Modular Cloud (OpenAI-compatible API)

Minimal coding agent on Modular Cloud

A small coding agent that builds a single-page web app from one prompt, using a model on Modular Cloud's shared endpoints through its OpenAI-compatible API. It's one loop: call the model, run any tool calls it asks for (write_file, read_file), send the results back, and stop when it's done.

Run it

# optionally, set up your virtual environment first
pip install openai
export MODULAR_API_KEY=your-key-here
The standard Lorem Ipsum passage, used since the 1500s
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC
"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, cons
@tommyjtl
tommyjtl / Exquisite Sango-Blad.stl
Last active May 13, 2025 05:04
module 4 arch 171
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tommyjtl
tommyjtl / pdf-compress.sh
Created January 26, 2024 17:48
PDF compression CLI with Ghostscript.
pdf-compress() {
QUALITY=150
INPUT_PDF=""
GS_BIN=$(command -v gs)
print_usage() {
echo "Usage: pdf-compress [-q|--quality <res>] <file>"
echo " Where:"
echo " -q|--quality <res> is the resolution for the PDF (default: 150)"
echo " <file> is the PDF file to compress"
@tommyjtl
tommyjtl / enter.sh
Last active July 2, 2026 05:14
A bash function command that quickly takes me to certain directory.
enter() {
local config_dir="$HOME/.config/enter"
local config_file="$config_dir/enter.yml"
# Initialize configuration
if [ ! -d "$config_dir" ]; then
mkdir -p "$config_dir"
fi
if [ ! -f "$config_file" ]; then
local user_root=$(pwd )
@tommyjtl
tommyjtl / python-arm.sh
Created October 27, 2023 19:05
Bash function to quickly launch the arm64 version of Python on macOS with Apple Silicon.
python-arm() {
# Get the platform information
platform=$(uname -m)
# Check if the platform is darwin arm
if [[ "$platform" == "arm64" ]]; then
# Run the desired command if on darwin arm platform
/opt/homebrew/opt/python@3.9/bin/python3.9 "$@"
else
# Exit if not on darwin arm platform
@tommyjtl
tommyjtl / README.md
Last active August 15, 2023 16:10
Serving Secured WebSocket Server (wss://) via Nginx and PM2.

This gist demonstrated the example use of serving secured WebSocket server (wss://) using Python's websockets via Nginx and PM2 the process manager. Have not tested thoroughly on production, so this is only for development use.

  • For fullchain.pem and privkey.pem, you will need use cerbot to generate them.
  • For pm2.json, run pm2 start pm2.json to run the WebSocket server in the background.
function cocomod() {
# port list all detected ports: python3 -m there detect
# run run local file on module (not send): python3 -m there run [FILE]
# list list file: python3 -m there ls -l [/] python3 -m there run [FILE]
# send send file to module: python3 -m there push [FILE] [/]
# read get source code from file on module: python3 -m there cat [FILE]
# delete delete file from module: python3 -m there rm [FILE]
# repl enter repl: python3 -m there -i
# echo "Usage: burn, goto, port, run, list, send, read, delete, repl"
import subprocess, os
current_path = os.getcwd()
current_file_list = os.listdir()
def exec_command(cmd):
command = cmd.split()
command_output = subprocess.run(command, capture_output=True)
for line in command_output.stdout.decode("utf-8").split("\n"):
print("\t\t", line)
@tommyjtl
tommyjtl / dopa-rev5_withname.stl
Last active June 26, 2020 04:43
Ring for lovers. License under CC 4.0 BY-SA.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.