Skip to content

Instantly share code, notes, and snippets.

@paulc
paulc / util.sh
Created December 16, 2020 17:05
Shell Utils
#!/bin/sh
set -o pipefail errexit nounset
_NORMAL=$(printf "\033[0m")
_RED=$(printf "\033[0;31m")
_YELLOW=$(printf "\033[0;33m")
_CYAN=$(printf "\033[0;36m")
_COLOUR=1
@paulc
paulc / ifconfig
Created December 14, 2020 23:05
FreeBSD 12.2 IPv6 jail/nat64
vtnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=2c00b9<RXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,VLAN_HWTSO,LINKSTATE,RXCSUM_IPV6>
ether 96:00:00:7f:3b:b0
inet6 2a01:4f8:c010:26a1::1 prefixlen 64
inet6 fe80::9400:ff:fe7f:3bb0%vtnet0 prefixlen 64 scopeid 0x1
inet 168.119.244.209 netmask 0xffffffff broadcast 168.119.244.209
media: Ethernet 10Gbase-T <full-duplex>
status: active
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
@paulc
paulc / jail-base.conf
Last active December 9, 2020 17:54
IPv6 Jail
allow.set_hostname=false;
allow.raw_sockets;
allow.socket_af;
allow.sysvipc;
allow.chflags;
mount.devfs;
devfs_ruleset = 4;
@paulc
paulc / ifconfig
Last active November 30, 2020 20:57
FreeBSD NAT64 (tayga) Config
# ifconfig -a
vtnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=6c07bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWTSO,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
ether 96:00:00:7f:3b:b0
inet6 2a01:4f8:c010:26a1::1 prefixlen 128
inet6 fe80::9400:ff:fe7f:3bb0%vtnet0 prefixlen 64 scopeid 0x1
inet6 2a01:4f8:c010:26a1:1000::1 prefixlen 128
inet 168.119.244.209 netmask 0xffffffff broadcast 168.119.244.209
media: Ethernet 10Gbase-T <full-duplex>
status: active
@paulc
paulc / init.sh
Last active April 8, 2021 22:16
Pot Startup Script
#!/bin/sh
set -o pipefail errexit nounset
_NORMAL=$(printf "\033[0m")
_RED=$(printf "\033[0;31m")
_YELLOW=$(printf "\033[0;33m")
_CYAN=$(printf "\033[0;36m")
_COLOUR=1
@paulc
paulc / cli.py
Created November 1, 2020 18:14
Nexmo CLI
#!/usr/bin/env python3
import os
import click
import nexmo
from tabulate import tabulate
client = nexmo.Client(os.environ['NEXMO_KEY'], os.environ['NEXMO_SECRET'])
@paulc
paulc / fail.go
Created October 28, 2020 00:25
TinyGo / WioTerminal - Strange behaviour reading Accelerometer in goroutine
package main
import (
"fmt"
"image/color"
"machine"
"time"
"tinygo.org/x/drivers/ili9341"
"tinygo.org/x/drivers/lis3dh"
@paulc
paulc / msgbuf.go
Created October 25, 2020 15:40
Simple Golang Msgbuf
package msgbuf
type Msgbuf struct {
msg []string
overflow bool
length, ri, wi int
}
func NewMsgbuf(length int) *Msgbuf {
@paulc
paulc / stm32f411.diff
Created October 12, 2020 20:17
WeAct stm32f411
diff --git a/src/machine/board_weact_stm32f411.go b/src/machine/board_weact_stm32f411.go
new file mode 100644
index 0000000..bdb1e97
--- /dev/null
+++ b/src/machine/board_weact_stm32f411.go
@@ -0,0 +1,49 @@
+// +build weact_stm32f411
+
+package machine
+
@paulc
paulc / mdns-proxy.sh
Last active June 28, 2020 15:00
mdns-proxy
mdns-proxy() {
: ${1?mdns-proxy target}
dns-sd -P ${1//.*} _http._tcp . 80 ${1//.*}.local $(dig +short $1 | head -1)
}