This repository contains small helper scripts or utilities that don't seem to merit their own repository, but probably deserve a better home than a throwaway Gist.
Script to aid the human->agent feedback loop via inline comments. Written up in a minipost.
A simple sandbox setup using unshare and nsenter, that will set up a
shared environment for running less-trusted applications (e.g. agents and
their output). See the Muxup page on shandbox
for more details.
A helper script for working with llvm-test-suite build configurations. Written up in more detail at the Muxup suite-helper page.
A simple wrapper around pypcode to dump the P-code (Ghidra's intermediate language for instruction semantics) for an instruction specified in hex. e.g.
$ ./instruction_to_pcode aarch64 b874c925
-- 0x0: ldr w5, [x9, w20, SXTW #0x0]
0) unique[0x5f80:8] = sext(w20)
1) unique[0x7200:8] = unique[0x5f80:8]
2) unique[0x7200:8] = unique[0x7200:8] << 0x0
3) unique[0x7580:8] = x9 + unique[0x7200:8]
4) unique[0x28b80:4] = *[ram]unique[0x7580:8]
5) x5 = zext(unique[0x28b80:4])
As different tools dump instruction encodings in little endian or big endian,
you may need to use --[no-]reverse-input to convert the input.
The intended use case is to save a trip to the ISA manual if you need to confirm the precise semantics of a given encoded instruction.
This was written against pypcode 1.1.2 (as packaged for Arch at the time of writing), though the API seems like it may have changed a bit in 2.0.
See the accompanying blog post for more information.
Uses fakeroot and user namespaces to provide rootless cross-architecture debootstrap.
A "hello world" usage example (assuming debootstrap, qemu-user-static, and qemu-user-static-binfmt are already installed):
./rootless-debootstrap-wrapper \
--arch=riscv64 \
--suite=sid \
--cache-dir="$HOME/debcache" \
--target-dir=hello-sid-riscv64 \
--include=build-essential
cat <<EOF > hello-sid-riscv64/hello.c
#include <stdio.h>
#include <sys/utsname.h>
int main() {
struct utsname buffer;
if (uname(&buffer) != 0) {
perror("uname");
return 1;
}
printf("Hello from %s\n", buffer.machine);
return 0;
}
EOF
./hello-sid-riscv64/_enter sh -c "gcc hello.c && ./a.out"See the accompanying blog post for more information.
The MIT-0 license.