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 / 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 / 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 / gist:52f7b185d4b4a57449bd56779aac3c86
Created July 30, 2022 04:13
fetch dependencies for a local package file
pkg fetch -U -d -o ~/my_new_packages \
$(pkg info -R --raw-format json -F release_test-0.1.0.pkg | jq -r '.["deps"] | keys | join(" ")')
gce_instance:
image_project: ratio-ops
image_name: ratio-freebsd-13-1-ci-1657673300
platform: freebsd
zone: us-west1-a
type: n1-standard-8
@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
postgres_service:
container:
image: postgres:14
port: 5432
POSTGRES_PASSWORD: ""
build_task:
freebsd_instance:
image_family: freebsd-13-1
build_script: echo "hello world"
CREATE TABLE users (id serial PRIMARY KEY NOT NULL, username text NOT NULL);
INSERT INTO users (username) VALUES ('admin');
INSERT INTO users (username) VALUES ('pat');
CREATE RULE no_delete_admin AS ON DELETE TO users WHERE username='admin' DO INSTEAD NOTHING;
SELECT * FROM users;
DELETE FROM users;
SELECT * FROM users;
PORTNAME= disport
PORTVERSION= 0.1.1
CATEGORIES= ports-mgmt
MAINTAINER= pat@patmaddox.com
COMMENT= no comment
NO_CHECKSUM= yes
NO_BUILD= yes
@patmaddox
patmaddox / drafts.org
Last active May 1, 2022 06:52
Drafts config for ox-hugo

Drafts

Drafts

@patmaddox
patmaddox / jail.conf
Created April 11, 2022 19:23
freebsd vnet jail config
host.hostname = "pat-$name";
vnet;
mount.devfs;
exec.clean;
exec.start = "sh /etc/rc";
exec.stop = "sh /etc/rc.shutdown";
path = "/jail/$name";
devfs_ruleset = 6;
vnet.interface = "epair${epair}b";
exec.prestart = "ifconfig epair${epair} create up";