Skip to content

Instantly share code, notes, and snippets.

View paigeadelethompson's full-sized avatar
💭
🧫 making stuff

Paige Thompson paigeadelethompson

💭
🧫 making stuff
View GitHub Profile
@paigeadelethompson
paigeadelethompson / bgpd.conf
Last active April 26, 2024 18:34
OpenBSD router
AS 1981800
fib-update yes
log updates
vpn "VMNET" on mpe0 {
rd 1981800:2000
import-target rt 1981800:2000
export-target rt 1981800:2000
network inet connected
network inet6 connected
[ 751.738319] hid_xpadneo: loading out-of-tree module taints kernel.
[ 751.738631] loaded hid-xpadneo v0.9-144-g9b3b696
[ 760.908133] xpadneo 0005:045E:0B13.0009: BLE firmware version 5.01, please upgrade for better stability
[ 760.908137] xpadneo 0005:045E:0B13.0009: pretending XB1S Windows wireless mode (changed PID from 0x0B13 to 0x028E)
[ 760.908138] xpadneo 0005:045E:0B13.0009: working around wrong SDL2 mappings (changed version from 0x00000501 to 0x00001130)
[ 760.908140] xpadneo 0005:045E:0B13.0009: report descriptor size: 283 bytes
[ 760.908141] xpadneo 0005:045E:0B13.0009: fixing up Rx axis
[ 760.908141] xpadneo 0005:045E:0B13.0009: fixing up Ry axis
[ 760.908142] xpadneo 0005:045E:0B13.0009: fixing up Z axis
[ 760.908143] xpadneo 0005:045E:0B13.0009: fixing up Rz axis
for x in $(curl -L -k -s http://www.textfiles.com/artscene/ansi/bbs/ | tr ' ' '\n' | grep HREF | tr '"' ' ' | awk '{print $2}' | grep -P "(ans|vt)" | grep -v ".png" | grep "." | shuf); do
#echo $x
curl -L -k -s http://www.textfiles.com/artscene/ansi/bbs/$x | iconv -f 437 -t utf-8 | pv -q -L 600
done
distinct_networks = [index for index, _ in groupby([
index for index in dotenv.keys()
if index.endswith("_NET_4")
or index.endswith("_NET_6")],
key=lambda k: re.match("^[^_]+(?=_)", k).group())]
net_zip = zip(
[index for index in range(128, 128 + (len(distinct_networks) * 2)) if index % 2 == 0],
[index for index in range(128, 128 + (len(distinct_networks) * 2)) if ind
r, w = os.pipe2(os.O_NONBLOCK)
with open(Path("/proc/{pid}/fd/{fd}".format(pid=os.getpid(), fd=w)), "wb") as script:
script.write("""#!/usr/bin/env bash
bash -c "/opt/netcrave/bin/dockerd \
--config-file /etc/netcrave/_netcrave.json \
" \
exit ; true
""".encode("utf-8", "strict"))
make defconfig && mv .config config.defconfig
make allmodconfig && mv .config config.allmodconfig
cat config.defconfig | grep "=y" > .config
find lib/ crypto/ fs/ net/ drivers/ -type f -name "Kconfig" | xargs -i grep "^menuconfig " {} | grep -vP "(DEBUG|TEST)" | awk '{print "CONFIG_"$2}' | xargs -i scripts/config -e {}
cat config.allmodconfig | grep "=m" >> .config
make olddefconfig
cp /boot/config-5.10.0-22-amd64 .config
scripts/config -u CONFIG_SYSTEM_TRUSTED_KEYS
scripts/config -u CONFIG_BUILD_SALT
scripts/config -u CONFIG_CC_VERSION_TEXT
make olddefconfig
make V=1 -j4 all
@paigeadelethompson
paigeadelethompson / async_subprocess_with_logger.py
Last active December 18, 2023 07:42
asyncio subprocess command executor with python logging and stderr/stdio duplex
# IAmPaigeAT (paige@paige.bio) 2023
import logging
import asyncio.subprocess
import subprocess
import os, tempfile
from os import O_NONBLOCK
import itertools
from pathlib import Path
import sys
import time
@paigeadelethompson
paigeadelethompson / net.sh
Created December 13, 2023 20:52
NetNS / VRF with routes and ipv6
#!/bin/bash
/usr/bin/env ip netns delete _netcrave
/usr/bin/env ip link del vrf2
/usr/bin/env ip route flush table 2
/usr/bin/env ip rule add to 198.51.100.0/30 table 2
/usr/bin/env ip netns add _netcrave
/usr/bin/env ip netns exec _netcrave ip link set lo up
/usr/bin/env ip netns exec _netcrave ip link add ns0vrf2 type vrf table 2
def get_network_object(self, network, prefix_length):
net = ip_address(network)
if type(net) == IPv4Address:
return IPv4Network(net).supernet(new_prefix = prefix_length)
elif type(net) == IPv6Address:
return IPv6Network(net).supernet(new_prefix = prefix_length)
def network_object_to_uuid(self, network):
if type(network) == IPv4Network:
return uuid.UUID(bytes = bytes([0x00] * 12) + network.network_address.packed)