This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from threading import Event, Thread | |
import bpy | |
from inotify_simple import INotify, flags | |
import traceback | |
# this is still buggy on properly cleaning things up on exit | |
def run(exit: Event, changed: Event, filename): | |
inotify = INotify() | |
inotify.add_watch(filename, flags.MODIFY) |
NewerOlder