Skip to content

Instantly share code, notes, and snippets.

View mrexodia's full-sized avatar
🍍

Duncan Ogilvie mrexodia

🍍
View GitHub Profile
"""Minimal MCP server with pi-like tools for workshops.
This version is intentionally small and easy to read.
It is not a full behavioral match for pi's native tools.
Each tool includes comments describing what a production version would need.
"""
import argparse
import datetime
import os
"""Example MCP server with pi-like tools."""
import argparse
import datetime
import os
import re
import subprocess
import tempfile
from dataclasses import dataclass
from typing import Annotated, Literal, Optional
@mrexodia
mrexodia / fetch_pipeline.py
Created February 23, 2026 18:27
Gitlab Pipeline Utilities
#!/usr/bin/env python3
"""
Fetch CI pipeline job logs and artifacts locally.
Usage:
# Default: latest pipeline for current branch
# Logs for all jobs, artifacts for failed jobs only
python3 tools/ci/fetch_pipeline.py
# Specific pipeline
@mrexodia
mrexodia / answer.md
Created November 23, 2025 12:55
When a breakpoint is triggered, how should I use a script function to print each member of a std::vector pointed to by the `rcx` register?

DeepWiki Q&A with Code Context for Repository: x64dbg/x64dbg

Q1

When a breakpoint is triggered, how should I use a script function to print each member of a std::vector pointed to by the rcx register?

Answer

To print each member of a std::vector pointed to by the rcx register when a breakpoint is triggered, you need to understand the memory layout of std::vector and use x64dbg's scripting capabilities with breakpoint commands.

Solution Approach

1. Set up a breakpoint command

@mrexodia
mrexodia / elf_mapper.py
Created June 13, 2025 15:39
Dumb ELF mapper POC
import logging
from dataclasses import dataclass
from typing import Optional
from enum import Enum
from elftools.elf.elffile import ELFFile
from elftools.elf.relocation import RelocationSection
from elftools.elf.sections import SymbolTableSection
logging.basicConfig(level=logging.DEBUG)
@mrexodia
mrexodia / zlib-utils.cpp
Created May 29, 2025 09:06
Simple ZLIB utility functions.
#include <vector>
// https://github.com/richgel999/miniz (MIT)
#include <miniz.h>
static std::vector<uint8_t> zlib_compress(const void *data, size_t size) {
uLongf compressed_size = compressBound(size);
std::vector<uint8_t> compressed(compressed_size);
int res = compress(compressed.data(), &compressed_size, (const unsigned char *)data, size);
@mrexodia
mrexodia / litellm_lm_studio_generate.py
Created April 18, 2025 21:50
Automatically generate LiteLLM config for all models in LM Studio
import argparse
import json
import urllib.request
import urllib.error
import sys
import yaml
def generate(prefix, model_id, endpoint, api_key):
return {
"model_name": f"{prefix}/{model_id}",
@mrexodia
mrexodia / tornado-thread.py
Created January 21, 2025 16:29
Tornado graceful shutdown from a thread
import threading
import tornado.ioloop
import tornado.web
import time
import asyncio
import logging
import requests
g_ioloop = None
g_server = None
@mrexodia
mrexodia / binja.sh
Last active January 8, 2026 12:21
Simple utility to quickly open a file in Binary Ninja on your mac
#!/bin/sh
if [ "$#" -gt 0 ]; then
xattr -c "$1"
fi
open -a "Binary Ninja" "$@"
#!/bin/bash
FEATURE=$(git branch --show-current)
if git show-ref --quiet refs/remotes/origin/main; then
MAIN=main
elif git show-ref --quiet refs/remotes/origin/master; then
MAIN=master
else
echo "No main branch found" >&2
exit 1