Skip to content

Instantly share code, notes, and snippets.

Avatar
🛋️

Dave Cottlehuber dch

🛋️
View GitHub Profile
View dumpacpi.sh
#!/bin/bash
#
# dumpACPItables, get all Tables from Mac OS X ioreg.
#
# 06-19-2009 AlainTox714
#
# path: /usr/local/bin
#
ACPIdir="/Users/${USER}/Desktop/ACPI_tables"
View websockets-with-gun.ex
defmodule Transport do
def connect(params) do
hostname = params.hostname
port = params.port
path = params.path
timeout = params.connection_timeout
{:ok, conn} = :gun.open(hostname, port)
{:ok, :http} = :gun.await_up(conn)
:gun.ws_upgrade(conn, path)
@dch
dch / arm64_zig_0.8.0.log
Last active Jun 11, 2021
poudriere says no
View arm64_zig_0.8.0.log
=>> Building lang/zig
build started at Fri Jun 11 19:14:25 UTC 2021
port directory: /usr/ports/lang/zig
package name: zig-0.8.0
building for: FreeBSD pkg.skunkwerks.at 13.0-RELEASE FreeBSD 13.0-RELEASE arm64
maintained by: dch@FreeBSD.org
Makefile datestamp: -rw-r--r-- 1 dch wheel 893 Jun 11 17:36 /usr/local/poudriere/data/.m/13_0_a64-default/01//usr/ports/lang/zig/Makefile
Poudriere version: 3.3.99.20210521
Host OSVERSION: 1400018
Jail OSVERSION: 1300139
View fission.rst
View gist:6bb2d81372cf850b42955afa99a4c3e6
commit 1c63e38a8878d24a011f37f4d1f13865f5bb5aa6
Author: Dave Cottlehuber <dch@FreeBSD.org>
Date: Fri Jun 11 08:10:42 2021 +0000
ftp/curl: build with contentious patch from PR#7039
diff --git ftp/curl/Makefile ftp/curl/Makefile
index 0e979ef5a475..89cba3031c7c 100644
--- ftp/curl/Makefile
+++ ftp/curl/Makefile
View jz.fish
function jz
# see https://git.io/JfHOu
set local
set DOMAIN skunkwerks.at
# find the zpool
set ZPOOL (zfs list -Ho name /jails | cut -f 1 -d /)
# grab the name
set JAIL $argv[1]
# create mountpoint if missing
zfs list -Ho name $ZPOOL/jails > /dev/null 2>&1 \
@dch
dch / _zerotier_vpn_on_freebsd.md
Last active Apr 1, 2021
how to set up FreeBSD as a zerotier.com vpn
View _zerotier_vpn_on_freebsd.md

I'm using [PORT]net/zerotier[/PORT] for quite some time as a way of getting to my systems from other networks very happily. It works in airports, cafes, and all the usual hostile places we travel to.

It provides a L2 encrypted mesh (a bit like VXLAN I suppose) via a tap interface.

What I'd like to do is to use the ZT network as a VPN - routing all traffic from my FreeBSD laptop and phone through the zerotier layer out to my appointed ZT "VPN Gateway". Basically, translating the linux doc here: https://support.zerotier.com/knowledgebase.php?entry=show&search-for=full&article=ZWFhNWMyMTZjODY1ODcwNmFhZmJjYmRhN2I5MjRhOGQ_ -- into FreeBSD config. BTW https://www.zerotier.com/manual.shtml has a lot of background detail if you're interested.I can get the iphone working, but not the laptop.

What works after configuring zerotier to provide the "default route" is different on each device:

  • the iphone works
  • an apple imac works
@dch
dch / main.yml
Created Dec 12, 2018
ansible zerotier role
View main.yml
---
- name: zerotier | install pkg
pkgng:
state: latest
name:
- net/zerotier
notify: zerotier | restart
tags:
- pkg
- zerotier
@dch
dch / sha.erl
Created May 18, 2014
erlang quick conversion of binary sha hash to printable hex/ascii
View sha.erl
(akai@akai)27> Hex=fun(<<Hash:20/big-unsigned-integer-unit:8>>) ->
lists:flatten(io_lib:format("~40.16.0b", [Hash])) end.
#Fun<erl_eval.6.106461118>
(akai@akai)28> Hex(<<200,152,0,191,200,46,208,30,214,227,191,213,64,140,81,39,68,145,247,212>>).
"c89800bfc82ed01ed6e3bfd5408c51274491f7d4"
(akai@akai)29>
@dch
dch / _aarch64_getting_started.md
Last active Jun 23, 2020
see the depenguinator script
View _aarch64_getting_started.md

de-penguinator - a fishy hack https://git.io/JeQDW to de-linux your systems

packet's big aarch64 servers don't have a FreeBSD ZFS image available, but we can fix that. We have the EFI partition, a 4GiB swap partition, and with Ubuntu 18.04, comes zfs. Anything is possible.

  • use packet.net to create an Ubuntu 18.04 install of either Ampere hr330a or cavium thunderX2
  • adapt depenguinator.sh as needed, it duplicates the current host's network settings
  • enjoy FreeBSD zfs sweetness after a short reboot