Skip to content

Instantly share code, notes, and snippets.

@cetex
cetex / *README.md
Created September 6, 2025 14:34 — forked from ruvnet/*README.md
ChatGPT Codex Agent.md and environment setup script

Getting Started with ChatGPT Codex + Mastra Agents

Step-by-Step Instructions

  1. Open the ChatGPT Codex task setup panel. This is where you configure your environment before starting a task.

  2. Locate the "Setup Script" field. You’ll see a note that internet access is disabled after the script runs.

@cetex
cetex / docx-to-md.py
Created August 16, 2025 18:11
Python-script for Docx to Markdown with Criticmark-like output
import zipfile
from lxml import etree
import argparse
def process_element(elem, namespaces):
w = namespaces['w']
tag = elem.tag
if tag == f'{{{w}}}ins':
author = elem.attrib.get(f'{{{w}}}author', 'Unknown')
content = ''.join(process_element(child, namespaces) for child in elem)
@cetex
cetex / serial-aws-console
Last active January 4, 2025 17:27
Bash-script - Connect to serial-console on ec2 instances.
#!/bin/bash
set -e
usage() {
echo "Usage: $0 [-k <ssh-key> ] [-r <region>] instance_id" 1>&2
echo "Connect to Ec2-instance serial-console via ssh" 1>&2
echo "Options:" 1>&2
echo " -k ssh-key path to key uploaded to amazon for ssh-access OR" 1>&2
echo " name of key "my_key" will use ~/.ssh/my_key.pub" 1>&2
echo " -r region AWS region of instance, eu-west-1" 1>&2
@cetex
cetex / calculator.py
Created November 21, 2024 22:48
Minimum-amortization-calculator
#!python3
def calculate_min_initial_cost(loan, rate, inflation, years):
if rate == inflation:
return (loan * (1-rate))/years
else:
return (
(loan * (rate - inflation))
/
(
@cetex
cetex / etc_systemd_system-preset_50-default-preset
Created August 23, 2024 08:47
Systemd - Don't activate any service by default
# Set default state for services getting installed.
# Disable all services by default
disable *
# But if the service getting installed is ssh - enable it
enable ssh.service
@cetex
cetex / printer.cfg
Created November 26, 2023 21:12
Fan control override for klipper - Wait for fan (pauses print if it's taken longer then 100ms to reach correct fan speed)
[gcode_macro M107]
description: Override M107 - Call M106 S0 so we wait for fan to spin-down.
rename_existing: G99321321
gcode:
M106 S0
[gcode_macro M106]
description: Overide M106 with a macro which sets speed, calculates a target range then within 100ms pauses print and waits for fan to spool up / down if spead hasn't been reached.
rename_existing: G99123123
@cetex
cetex / printer.cfg
Last active November 23, 2023 09:19
Custom klipper macro which overrides M106 (set fan speed) with a macro that waits for the fan to reach the set fan speed (Within about 20%)
[gcode_macro M106]
description: Overide M106 with a macro which waits for fan to spool up / down.
variable_fan_rpm_extra_diff: 1000
rename_existing: G99123123
gcode:
{% set speed = params.S | default(255) | int %}
# From google sheets: https://docs.google.com/spreadsheets/d/1sft29z37njtjudYw_bwkCwU5Mn8ZIfSqpJF49LV38YE
# Formula: -6634 + 260x + -0.829x^2 + 1.23E-03x^3
{% set target_rpm = -6634 + 260 * speed + -0.829 * (speed **2) + 0.00123 * (speed ** 3) %}
# Clamp to minimum of 0.
@cetex
cetex / main.go
Created February 5, 2020 15:12
cloudwatch-systemd-logs
package main
import (
"flag"
"fmt"
"github.com/coreos/go-systemd/sdjournal"
"io/ioutil"
"log"
"regexp"
"time"
@cetex
cetex / gist:b3a1bcd3f4b2a31b3a88425fd543414c
Created February 6, 2019 09:14
QuteBrowser under Native Wayland
10:12:27 WARNING: WebEngine compiled with X11 support, however qpa backend is not xcb. This may fail.
[0206/101227.198997:WARNING:stack_trace_posix.cc(699)] Failed to open file: /home/oskar/#18746720 (deleted)
Error: No such file or directory
10:12:27 WARNING: Wayland does not support QWindow::requestActivate()
[16036:16056:0206/101227.977089:ERROR:nss_ocsp.cc(614)] No URLRequestContext for NSS HTTP handler. host: ocsp.digicert.com
[16036:16056:0206/101227.977118:ERROR:nss_ocsp.cc(614)] No URLRequestContext for NSS HTTP handler. host: ocsp.digicert.com
[16036:16056:0206/101227.978273:ERROR:nss_ocsp.cc(614)] No URLRequestContext for NSS HTTP handler. host: crl3.digicert.com
[16036:16056:0206/101227.979272:ERROR:nss_ocsp.cc(614)] No URLRequestContext for NSS HTTP handler. host: ocsp.digicert.com
[16036:16056:0206/101227.979291:ERROR:nss_ocsp.cc(614)] No URLRequestContext for NSS HTTP handler. host: ocsp.digicert.com
[16036:16056:0206/101227.979343:ERROR:nss_ocsp.cc(614)] No URLRequestContext for NSS HTTP hand
@cetex
cetex / make-deb-source.sh
Last active March 26, 2018 14:10
Ubuntu xenial nginx with upstream check module
#docker run -i -t -v $(pwd)/:/mnt ubuntu:xenial /bin/bash
# Add deb-src to apt
#sed -i 's/^# deb-src/deb-src/g' /etc/apt/sources.list
#apt-get update
# Grab build-dependencies
#apt-get install dpkg-dev git devscripts quilt
#apt-get build-dep nginx
# Grab nginx-source
apt-get source nginx
cd nginx-*