Skip to content

Instantly share code, notes, and snippets.

@Frank-Buss
Frank-Buss / convert.py
Created October 11, 2025 19:20
Converts commas in a gcode nc file to dots for the decimal separator
#!/usr/bin/env python3
"""
Proper G-code parser that fixes comma decimal separators.
G-code structure:
- Words: Letter followed by a number (e.g., G0, X123.456, Y-78.9)
- Comments: Text in parentheses ()
- Lines can have multiple words, with or without spaces
"""
import re
@Frank-Buss
Frank-Buss / analyze_gender_bias.py
Last active September 14, 2025 12:26
gender bias in language selection
#!/usr/bin/env python3
"""
Analyze gender bias in programming language choice using Stack Overflow Developer Survey data.
"""
import pandas as pd
import numpy as np
import matplotlib
matplotlib.use('Agg') # Use non-interactive backend
import matplotlib.pyplot as plt
@Frank-Buss
Frank-Buss / bluetooth.ps1
Created August 5, 2025 12:06
show Bluetooth adapter capabilities
# Bluetooth Peripheral Mode Checker
# to execute powershell scripts, you might need to enable this first:
# Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
Write-Host "=== Bluetooth Peripheral Mode Checker ===" -ForegroundColor Cyan
Write-Host ""
# Check for Bluetooth adapters
$usbBT = Get-PnpDevice -Class Bluetooth | Where-Object {$_.InstanceId -match "USB\\" -and $_.Status -eq "OK"}
@Frank-Buss
Frank-Buss / similar-image.py
Created May 4, 2025 20:28
applies recursively the same prompt for editing an image and then creates a mp4 video of it
#!/usr/bin/env python3
import os
import time
import argparse
import shutil
import requests
import subprocess
import io
import traceback
@Frank-Buss
Frank-Buss / tabletest.lua
Last active May 1, 2025 17:34
redefine pairs for all tables
local original_next = next
local original_pairs = pairs
local function sorted_next(t, k)
local keys = {}
for key in original_pairs(t) do
table.insert(keys, key)
end
table.sort(keys)
# run like this:
# julia -O3 --check-bounds=no tm.jl busy-beaver-5.json --fast
using ArgParse
using JSON
# ANSI codes for inverse video and reset
const INVERSE = "\u001B[7m"
const RESET = "\u001B[0m"
function parse_commandline()
@Frank-Buss
Frank-Buss / readme.md
Created January 24, 2025 00:06
detecting buffer overflow and other memory problems in Zephyr programs

First add this to your CMakeLists.txt file:

if(BOARD STREQUAL "native_posix_64")
  target_compile_options(app PRIVATE -fsanitize=address -fsanitize=undefined)
  target_link_options(app PRIVATE -fsanitize=address -fsanitize=undefined)
  target_link_libraries(app PRIVATE asan ubsan)
endif()

For testing I used the blinky example, and added this at the beginning of the main function:

@Frank-Buss
Frank-Buss / overflow.txt
Created January 5, 2025 19:05
demonstration of the overflow problem reported here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30475
frank@wopr:~/tmp$ cat overflow.c
#include <assert.h>
#include <stdio.h>
int foo(int a) {
assert(a+100 > a);
printf("%d %d\n",a+100,a);
return a;
}
@Frank-Buss
Frank-Buss / ip.py
Created September 23, 2024 20:45
get your IP address
#!/usr/bin/env python3
import requests
response = requests.get("https://httpbin.org/ip")
data = response.json()
ip = data.get("origin", "Unknown")
print(f"Your IP address is: {ip}")
@Frank-Buss
Frank-Buss / bitflips.py
Created September 17, 2024 07:58
Counts all possible single bit flip names for domain
import re
import sys
# List of valid TLDs (this is a small subset, you may want to use a more comprehensive list)
VALID_TLDS = set(['com', 'org', 'net', 'edu', 'gov', 'io', 'co', 'uk', 'de', 'fr', 'jp', 'cn', 'au', 'us'])
def is_valid_domain(domain):
pattern = r'^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z]{2,})+$'
if not re.match(pattern, domain):
return False