Skip to content

Instantly share code, notes, and snippets.

View dch's full-sized avatar
🛋️

Dave Cottlehuber dch

🛋️
View GitHub Profile
@dch
dch / Makefile
Last active September 22, 2016 10:22
Here's a racket version of a websocket cat. Sadly, racket doesn't produce a single distributable executable like OCaml or golang, so we have to make do with a turd-like tarball.
all: clean
@raco exe wsc.rkt
@raco distribute wscat wsc
clean:
@rm -rf wsc wscat
@dch
dch / daemon.c
Last active September 22, 2016 09:05
daemon.c from FreeBSD 11.0
/*-
* Copyright (c) 1999 Berkeley Software Design, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
commit 5e2ba2fbef502a980564c9d47e2a9d9f1ef4115b
Author: Dave Cottlehuber <[email protected]>
Date: Mon Aug 15 21:06:08 2016 +0000
www/h2o: add mruby support by default
diff --git a/www/h2o/Makefile b/www/h2o/Makefile
index 5d4b022..35fef29 100644
--- a/www/h2o/Makefile
+++ b/www/h2o/Makefile
@dch
dch / gh-dl-release
Created August 16, 2016 17:51 — forked from maxim/gh-dl-release
Download assets from private Github releases
#!/usr/bin/env bash
#
# gh-dl-release! It works!
#
# This script downloads an asset from latest or specific Github release of a
# private repo. Feel free to extract more of the variables into command line
# parameters.
#
# PREREQUISITES
#
@dch
dch / _etc_fstab
Last active July 21, 2016 11:48
build failure on mbp, successfully built on intel nuc: FreeBSD 12.0-CURRENT (GENERIC) #0 r302914+e342f05(drm-next-4.6): Thu Jul 21 00:36:09 UTC 2016
# Device Mountpoint FStype Options Dump Pass#
/dev/ada0p2 none swap sw 0 0
tmpfs /tmp tmpfs rw,mode=01777,size=12g 0 0
tmpfs /usr/obj tmpfs rw,mode=01777,late 0 0
fdesc /dev/fd fdescfs rw 0 0
proc /proc procfs rw 0 0
@dch
dch / forwarding-example.md
Created June 15, 2016 07:08 — forked from f1sherman/forwarding-example.md
Port Forwarding Example in OS X El Capitan

Add the following to /etc/pf.anchors/myname:

rdr pass on lo0 inet proto tcp from any to any port 80 -> 127.0.0.1 port 4000
rdr pass on lo0 inet proto tcp from any to any port 443 -> 127.0.0.1 port 4001

Add the following to /etc/pf-myname.conf:

rdr-anchor "forwarding"
load anchor "forwarding" from "/etc/pf.anchors/myname"
/r/veertu/l/v/action ╍ funced ramdisk
ramdisk> function ramdisk
             set size (math "$argv[1] * 2097152")
             diskutil eject /Volumes/ramdisk >/dev/null 2>&1
             set ramdiskpath (hdiutil attach -nomount ram://$size)
             diskutil erasevolume HFS+ 'ramdisk' "$ramdiskpath"
         end
 /r/veertu/l/v/action ╍ ramdisk 24                                                                                                   (913ms)
Unable to find disk for /dev/disk1
@dch
dch / refind.conf
Created May 23, 2016 19:35 — forked from anonymous/dpaste.de_snippet.py
FreeBSD & Ubuntu-based refind.conf
# textmode 2
#resolution 2880 1800
resolution 1440 900
timeout 5
# ignore FreeBSD loader in native FAT EFI partition
dont_scan_dirs /boot /EFI/freebsd /EFI/ubuntu
dont_scan_files boot1.efi
menuentry "FreeBSD 11.0-current" {
loader \EFI\freebsd\current.efi
[Wed, 03 Feb 2016 13:50:37 GMT] [info] [<0.426.0>] 127.0.0.1 - - PUT /testy/random 201
[Wed, 03 Feb 2016 13:50:37 GMT] [info] [<0.10668.0>] 127.0.0.1 - - GET /testy/random?deleted_conflicts=true 200
[Wed, 03 Feb 2016 13:50:37 GMT] [info] [<0.426.0>] 127.0.0.1 - - POST /testy/_bulk_docs 201
[Wed, 03 Feb 2016 13:50:38 GMT] [info] [<0.426.0>] 127.0.0.1 - - PUT /testy/random 201
[Wed, 03 Feb 2016 13:50:38 GMT] [info] [<0.426.0>] 127.0.0.1 - - POST /testy/_bulk_docs 201
[Wed, 03 Feb 2016 13:50:38 GMT] [info] [<0.426.0>] 127.0.0.1 - - PUT /testy/random 201
[Wed, 03 Feb 2016 13:50:38 GMT] [info] [<0.426.0>] 127.0.0.1 - - POST /testy/_bulk_docs 201
[Wed, 03 Feb 2016 13:50:38 GMT] [info] [<0.115.0>] 127.0.0.1 - - GET /testy/random?deleted_conflicts=true 404
[Wed, 03 Feb 2016 13:50:39 GMT] [info] [<0.426.0>] 127.0.0.1 - - PUT /testy/random 201
[Wed, 03 Feb 2016 13:50:39 GMT] [info] [<0.426.0>] 127.0.0.1 - - POST /testy/_bulk_docs 201
@dch
dch / update-ip.sh
Created January 18, 2016 07:25 — forked from audy/update-ip.sh
#!/bin/bash
set -euo pipefail
hostname="test.austinfanclub.com"
# use -s6 and -s4 to ensure that a failed curl causes the script to bail correctly
ip6=`curl -s6 http://ipv6.icanhazip.com/`
ip4=`curl -s4 http://ipv4.icanhazip.com/`
curl \
--user "[email protected]:`pass iwantmyname`" \
"https://iwantmyname.com/basicauth/ddns?hostname=${hostname}&myip=${ip6}"
curl \