Skip to content

Instantly share code, notes, and snippets.

View gwollman's full-sized avatar

Garrett Wollman gwollman

View GitHub Profile

The following guide was copied from our private internal documentation, but there's nothing private in it, we just don't have anywhere to publish documentation like this. By the time you read it, it will likely be out of date and may not reflect our current practice. Some references to our internal configuration management remain; you'll have to figure those bits out for yourself.

Provisioning of PostgreSQL replicas is complicated. It's more complicated still if we want to use secure authentication, which is why we haven't done it before (despite the best of intentions). This guide will follow my (wollman's) process in setting this up for

@gwollman
gwollman / type-samples.ps
Created February 26, 2022 03:17
A trivial program to generate type samples of the standard PostScript fonts
%!PS-
/fonts [ /Bookman-Light /Times-Roman /Palatino-Roman /NewCenturySchlbk-Roman
/AvantGarde-Book /ZapfChancery-MediumItalic /Courier /Helvetica
/Symbol /ZapfDingbats ] def
/size 36 def
/leading 12 def
/showit {
dup
diff --git a/security/openssh-portable/Makefile b/security/openssh-portable/Makefile
index b77a243d16cf..771c012f83b2 100644
--- a/security/openssh-portable/Makefile
+++ b/security/openssh-portable/Makefile
@@ -100,21 +100,21 @@ PATCH_SITES+= http://mirror.shatow.net/freebsd/${PORTNAME}/:DEFAULT,hpn,gsskex
# Must add this patch before HPN due to conflicts
.if ${PORT_OPTIONS:MKERB_GSSAPI} || ${FLAVOR:U} == gssapi
-BROKEN= KERB_GSSAPI No patch for ${DISTVERSION} yet.
. if ${PORT_OPTIONS:MHPN} || ${PORT_OPTIONS:MNONECIPHER}
@gwollman
gwollman / screencast.sh
Created October 27, 2021 01:36
A simple shell script to record the contents of a window to a video file using only ffmpeg
#!/bin/sh
outfile="${1-screencast.mp4}"
echo -n 'Click on the window you wish to record...'
tmpfile=$(mktemp /tmp/screencast.XXXXXX)
trap "rm -f $tmpfile" 0 1 3 15
xwininfo > $tmpfile
echo 'done.'
origin=$(awk '/Corners:/ { print $2 }' $tmpfile | sed 's/\(+[[:digit:]]*\)+/\1,/')
@gwollman
gwollman / check_smtp_starttls.sh
Last active January 22, 2021 01:37
Use openssl s_client to check the TLS certificates of an SMTP server using STARTTLS
#!/bin/sh
echo QUIT | openssl s_client -connect "$1":25 -starttls smtp -name "$1" -showcerts -verify 1 -verify_return_error
# To send a client certificate, add:
# -cert /path/to/cert -key /path/to/key -cert_chain /path/to/chain
# for example, if you are using acmetool(1),
# acmedir=/var/db/acme/live/$(hostname)
# -cert $acmedir/cert -key $acmedir/privkey -cert_chain $acmedir/full_chain
#!/bin/sh
# Yes, I know you could do the egrep inside of sed.
zpool status | egrep '(pool|scan):' | sed '/pool/{N;s/ pool: //;s/\n scan//;}'
@gwollman
gwollman / post-titles.xsl
Created December 30, 2019 20:47
A simple XSLT transform to extract post dates and titles from a WordPress export file
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wp="http://wordpress.org/export/1.2/"
version='1.0'>
<xsl:output method='text' encoding='utf-8'/>
<xsl:template match="/">
<xsl:apply-templates select="/rss/channel/item[wp:post_type = 'post']"/>
</xsl:template>
@gwollman
gwollman / hddtemp_nvmecontrol
Created December 30, 2018 06:52
An altered verson of Lutz Peter Christoph's hddtemp_smartctl munin plugin to monitor NVMe drives using nvmecontrol
#!/usr/local/bin/perl -w
# -*- perl -*-
use strict;
use warnings;
=head1 NAME
hddtemp_nvmecontrol - Plugin to monitor NVMe SSD temperatures through
SMART