Skip to content

Instantly share code, notes, and snippets.

Dave Cottlehuber dch

Block or report user

Report or block dch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dch /
Last active Oct 11, 2017
tarsnap hacky parallel restore script
# recover all files in parallel from the most recent archive
# MIT license
# "works on my machine"
# lots of assumptions notably path length (strip-component)
# get the latest archive as our names can be sorted by time
ARCHIVE=`tarsnap --keyfile /tmp/tarsnap.key --list-archives | sort | tail -1`
#!/usr/bin/perl -w
# recover rsyslog disk queue index (.qi) from queue files (.nnnnnnnn).
# See:
# runtime/queue.c: qqueuePersist()
# runtime/queue.c: qqueueTryLoadPersistedInfo()
# 2012-03-14
use strict;
dch /
Created Sep 18, 2017
how to debug rsyslog

debugging rsyslog

export RSYSLOG_DEBUGLOG=/var/log/rsyslog/debug.log
/usr/local/sbin/rsyslogd -i /var/run/ -f /usr/local/etc/rsyslog.conf -dn
tee -a /var/log/rsyslog/debug.log
dch /
Last active Jan 20, 2019
how to set up FreeBSD as a vpn

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: -- into FreeBSD config. BTW 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
View Xorg.0.log
[ 394.896]
X.Org X Server 1.18.4
Release Date: 2016-07-19
[ 394.896] X Protocol Version 11, Revision 0
[ 394.896] Build Operating System: FreeBSD 12.0-CURRENT amd64
[ 394.896] Current Operating System: FreeBSD 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r320546+9ecc1769c831(drm-next): Sun Jul 2 00:10:54 UTC 2017 root@wintermute:/usr/obj/usr/src/sys/GENERIC amd64
[ 394.896] Build Date: 27 May 2017 01:35:38PM
[ 394.896]
[ 394.897] Current version of pixman: 0.34.0
[ 394.897] Before reporting problems, check
View kraihlight.vim
set background=dark
hi clear
if exists("syntax_on")
syntax reset
let colors_name = "kraihlight"
# 1de8015 on Dec 19, 2016
from __future__ import (absolute_import, division, print_function)
import os
import pipes
from ansible.errors import AnsibleError
from ansible.plugins.connection.ssh import Connection as SSHConnection
from contextlib import contextmanager
# show the first argument passed to ether_input function 
dtrace -n 'fbt::ether_input:entry { print(*(args[0])); }'
# dump first 32 bytes of the dereferenced pointer to the actual data arriving on the wire
dtrace -n 'fbt:kernel:ether_input:entry { tracemem(args[1]->m_data, 32); }'
dch / mcorbin_config.clj
Last active May 24, 2017 — forked from faxm0dem/riemann-config.clj
riemann collectd watchdog
View mcorbin_config.clj
(with {:service "heartbeat" :ttl 120 } (index))
(where (service "heartbeat")
(by :host (...))))
dch / riemann-slack.clj
Created May 24, 2017
slack with rollups
View riemann-slack.clj
(defn format-slack-attachments
"Format attachments list from events."
[events mentions]
(let [event-count (count events)
event (last events)
description (:description event)
event-text (format-event-text event)
color (get-event-color event)]
(if (= event-count 1)
[{:text event-text
You can’t perform that action at this time.