Skip to content

Instantly share code, notes, and snippets.

View patmaddox's full-sized avatar
🤔
Trying to figure out how to look up comments I've left

Pat Maddox patmaddox

🤔
Trying to figure out how to look up comments I've left
View GitHub Profile
@patmaddox
patmaddox / 1_src_changes.txt
Last active April 13, 2024 19:11
make buildworld buildkernel - src changes
freebsd-src.git/b/main $ git status
On branch main
Your branch is up to date with 'origin/main'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
tests/sys/fs/fusefs/.depend.access
tests/sys/fs/fusefs/.depend.allow_other
@patmaddox
patmaddox / jail.conf
Created November 1, 2023 17:56
freebsd jail config with host configuring things in guest (iface name, resolv.conf, etc)
path = "/jails/${name}";
vnet;
$iface = "$name";
vnet.interface = "${iface}b";
host.hostname = "$name";
exec.clean;
exec.start = "sh /etc/rc";
exec.stop = "sh /etc/rc.shutdown jail";
exec.release = "ifconfig ${iface}a destroy";
enforce_statfs = 1;
@patmaddox
patmaddox / make_freebsd.sh
Last active July 27, 2023 08:05
script to build FreeBSD disk for cloud
#!/bin/sh
set -e
# Adapted from https://www.daemonology.net/blog/2019-02-16-FreeBSD-ZFS-AMIs-now-available.html
if [ ! $# -eq 2 ]; then
echo "Usage: configure.sh <cloud> <disk>"
echo " cloud: aws|gcp"
echo " disk: e.g. da1, nda1"
exit 1
@patmaddox
patmaddox / repeat.exs
Created April 14, 2023 03:19
elixir peg all CPUs (or not?)
IO.puts("Schedulers: #{System.schedulers_online()}")
Stream.repeatedly(fn -> 1 end)
|> Stream.with_index(1)
|> Task.async_stream(fn {val, index} ->
# if index % 1000 == 0 do
Process.sleep(:rand.uniform(10))
IO.puts(index)
# end
end, max_concurrency: 20)
@patmaddox
patmaddox / 5_10-graphics-cards.md
Last active March 23, 2023 04:48
linux graphics cards

Check out https://github.com/torvalds/linux at v5.10

amdgpu

  1. cd drivers/gpu/drm/amd/amdgpu
  2. grep -R MODULE_FIRMWARE | sed -e 's/.*(//' -e 's/);//' -e 's/"//g' | grep FIRMWARE | sort -u | tr '[:upper:]' '[:lower:]' | sed -e 's/firmware_//'

(note: a couple are left out from that list. full list of blobs can be produced with grep -R MODULE_FIRMWARE | sed -e 's/.*(//' -e 's/);//' -e 's/"//g' | sort -u | tr '[:upper:]' '[:lower:]' | sed -e 's/firmware_//' -e 's|amdgpu/||' | sort -u)

@patmaddox
patmaddox / zfs_ami.sh
Last active February 1, 2023 01:41
Configure FreeBSD AWS ZFS ZMI
#!/bin/sh
# adapted from https://www.daemonology.net/blog/2019-02-16-FreeBSD-ZFS-AMIs-now-available.html
mdconfig -a -t swap -s 3G -u 2
newfs /dev/md2
mkdir /mdisk
mount /dev/md2 /mdisk
tar -czf /mdisk/base.txz --exclude .snap -C /mnt .
umount /mnt
@patmaddox
patmaddox / mk_image.sh
Last active February 1, 2023 01:41
FreeBSD ZFS-on-Root (GCP)
#!/bin/sh
set -e
set -x
# Adapted from https://www.daemonology.net/blog/2019-02-16-FreeBSD-ZFS-AMIs-now-available.html
# Note: You need to run this on an instance with read/write access to Google Compute
# Alternatively, you can run the gcloud commands from somewhere with privileges
disk=da1
@patmaddox
patmaddox / pf.conf
Last active February 1, 2023 01:41
generic pf.conf w/ nat
ext_if="ena0"
ts_if="tailscale0"
set skip on lo
scrub in
# permissive NAT allows jail bridge and wireguard tunnels
nat on $ext_if inet from !($ext_if) -> ($ext_if:0)
block in
@patmaddox
patmaddox / snap_and_sync.sh
Created November 28, 2022 19:23
sanoid syncoid script
#!/bin/sh
set -e
sudo sanoid --cron --quiet
sudo syncoid --quiet -r --no-privilege-elevation --no-sync-snap --sendoptions="w" --recvoptions="u" --sshkey=/usr/home/patmaddox/.ssh/nas-rsyncnet zdata/crypt/istudo nas-user@myhost.rsync.net:zsync/snaps/istudo
@patmaddox
patmaddox / make_freebsd.sh
Created August 25, 2022 15:41
FreeBSD zfs-on-root cloud disk config
#!/bin/sh
# Adapted from https://www.daemonology.net/blog/2019-02-16-FreeBSD-ZFS-AMIs-now-available.html
if [ ! $# -eq 2 ]; then
echo "Usage: configure.sh <cloud> <disk>"
echo " cloud: aws|gcp"
echo " disk: e.g. da1, nda1"
exit 1
fi