Skip to content

Instantly share code, notes, and snippets.

View aconz2's full-sized avatar

Andrew Consroe aconz2

View GitHub Profile
@aconz2
aconz2 / report.md
Created January 21, 2025 17:46
how I flashed an artillery sidewinder x2 firmware

okay this should probably go in a bug report or get reported upstream but that is hard sometimes because it takes a lot of work to report and is sometimes murky who to report to and I feel like a bother when there are 8 million issues already. hoping this ends up in search results

I wanted to flash new marlin firmware 2.1.2.5 to get linear advance on an artillery sidewinder x2. I'm on linux fedora 40. I downloaded vs code with the auto build marlin extension and platformio version 6.1.16.

Build was successful but then hit an error when trying to flash/upload. using lsub I observe the stm32 device vendor id : product id (vid:pid) 0483:5740 and later when in bootloader mode 0483:df11.

Bus 001 Device 017: ID 0483:5740 STMicroelectronics Virtual COM Port <- example when not in bootloader mode

The error from platformio which uses openocd (tool-openocd @ 3.1200.0 (12.0)) was

@aconz2
aconz2 / inspecttar.py
Created October 25, 2024 20:10
little script to print out tar file info and also for oci image manifest per layer
#!/usr/bin/env python
import tarfile
import json
from pathlib import Path
import argparse
types = {}
for k in 'REGTYPE AREGTYPE LNKTYPE SYMTYPE DIRTYPE FIFOTYPE CONTTYPE CHRTYPE BLKTYPE GNUTYPE_SPARSE'.split():
types[getattr(tarfile, k)] = k
/*
* Do the thing in https://github.com/containers/bubblewrap/issues/592#issuecomment-2243087731
* unshare --mount
* mount --rbind / /abc --mkdir
* cd /abc
* mount --move . /
* chroot .
*/
#define _GNU_SOURCE
git clone https://github.com/bytecodealliance/wasmtime/
cd wasmtime
git checkout 87817f38a128caa76eaa6a3c3c8ceac81a329a3e
RUST_MIN_STACK=1048576 cargo build # segfaults
coredumpctl -1 dump > core
or
SYSTEMD_DEBUGGER=lldb coredumpctl -1 debug
RUST_MIN_STACK=1048576 strace --stack-traces -f --trace='open,openat' cargo build
@aconz2
aconz2 / qemu-fedora-cloud.sh
Last active July 9, 2024 21:27
qemu fedora cloud explicit kernel and initrd learnings
# download fedora cloud qcow2 image
wget https://download.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/x86_64/images/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2
# set root password to hello
virt-customize -a Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2 --root-password password:hello
# this extracts the kernel binary and initramfs from the qcow2 image
# this lets you pass custom kernel parameters, qemu requires passing -kernel in order to use -append
# https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html
virt-get-kernel -a Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2
@aconz2
aconz2 / Containerfile
Last active June 28, 2024 20:18
run singularity from a container just to test it out
# TODO idk what a good base package is
FROM ubuntu:24.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y wget \
cryptsetup \
libfuse-dev \
squashfs-tools \
uidmap \
@aconz2
aconz2 / lldbtest.py
Created August 8, 2021 17:20
Example using the lldb Python bindings to create breakpoints, run a program, and step through programatically
import lldb
import os
import sys
symbol_types = {}
for x in dir(lldb):
if x.startswith('eSymbolType'):
symbol_types[getattr(lldb, x)] = x[len('eSymbolType'):]
dbg = lldb.SBDebugger.Create()
@aconz2
aconz2 / inkscapeautosmoothnodes.py
Last active November 25, 2022 07:40
Implements the auto-smooth node type from Inkscape in Python with svgpathtools. Keywords: fitting cubic bezier curve spline points smooth
import svgpathtools as svg
from typing import List, Tuple
def points(path: svg.Path):
for seg in path:
yield seg.start
yield path.end
def normalized(x: complex) -> complex:
return x / abs(x)
@aconz2
aconz2 / cookie-cutter-cutter.scad
Created February 21, 2021 04:55
Easy way to make cookie cutters from an SVG or DXF using openscad for 3d printing
@aconz2
aconz2 / serve-serial.sh
Created February 12, 2021 22:55
proxy serial port from laptop to virtual machine running on a server
# on server that has virtual machine, IP is 192.168.1.207
# in virt-manager, add a serial port, it will show up as /dev/pts/something
sudo socat -d -d file:/dev/pts/1 TCP-LISTEN:9090
# on laptop that is plugged into device, -x will log communication as hex
sudo socat -x -d -d /dev/ttyUSB0,b9600,raw TCP:192.168.1.207:9090
# then remote into virtual machine and use the serial port!