Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jamesog on github.
  • I am jamesog (https://keybase.io/jamesog) on keybase.
  • I have a public key whose fingerprint is E9EB 3E24 C08C 0AE3 2A47 CA16 FF19 DF02 C0D7 49BD

To claim this, I am signing this object:

TarsnapArgs:
ExcludeFile: /root/crons/tarsnap.exclude
BackupDirs:
- /boot
- /etc
- /home
- /root
- /usr/local/etc
- /var/log
- /data/jail/boxbackup/etc
@jamesog
jamesog / gist:4c7f7b448a28f27dd51f
Created January 14, 2015 21:08
FreeBSD dmesg on DigitalOcean
Copyright (c) 1992-2014 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014
root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
CPU: Intel(R) Xeon(R) CPU E5-2630L v2 @ 2.40GHz (2400.01-MHz K8-class CPU)
Origin = "GenuineIntel" Id = 0x306e4 Family = 0x6 Model = 0x3e Stepping = 4
Features=0xf83fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2,SS>
@jamesog
jamesog / gist:7959418afec6ff3d224d
Created June 22, 2015 21:49
FreeBSD on Linode KVM dmesg
Copyright (c) 1992-2014 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.1-RELEASE-p10 #0: Wed May 13 06:54:13 UTC 2015
root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
CPU: Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz (2500.08-MHz K8-class CPU)
Origin = "GenuineIntel" Id = 0x306f2 Family = 0x6 Model = 0x3f Stepping = 2
Features=0xf8bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,SS>
if tmux has 2>/dev/null; then
echo "tmux sessions found:"
tmux ls
echo
echo -n "Attaching to default tmux session in 5 seconds. Press Ctrl-C to abort"
for ((i=5; i>0; i--))
do
printf "."
if read -s -t 1 -k ; then break; fi
done
@jamesog
jamesog / zpools.rb
Created May 9, 2013 16:58
Retrieving zpools in facter
require 'facter'
Facter.add('zpools') do
setcode do
zpools = []
if Facter::Util::Resolution.which('zpool')
Facter::Util::Resolution.exec('zpool list -Ho name').each_line do |line|
line.strip!
zpools << line
end
@jamesog
jamesog / siteadmin.sh
Created October 23, 2016 20:03
siteadmin.sh - ancient Apache vhost management script
#!/bin/sh
# siteadmin.sh
# Created 2005/01/07 by James O'Gorman <james@netinertia.co.uk>
#
# This script automatically creates directory structures and config file
# entries needed for a new website.
# It can also be used to clean up (remove) those entries when a website is
# no longer needed.
#
@jamesog
jamesog / context.go
Last active January 1, 2019 16:38
HTTP DB Context
package main
import (
"context"
"database/sql"
"log"
"net/http"
_ "github.com/lib/pq"
)
@jamesog
jamesog / mkinventory.pl
Last active September 2, 2019 22:45
Exporting from RackTables (e.g. for creating an inventory spreadsheet).
#!/usr/bin/env perl
use warnings;
use strict;
# Use modules installed with cpanm -L
use lib 'extlib/lib/perl5';
use DBI;
use POSIX qw(strftime);
use Spreadsheet::WriteExcel;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.jamesog.takeabreak</string>
<key>Program</key>
<string>/usr/bin/say</string>
<key>ProgramArgs</key>
<array>