Skip to content

Instantly share code, notes, and snippets.

View rlaager's full-sized avatar

Richard Laager rlaager

View GitHub Profile
@rlaager
rlaager / Four Christmases.xml
Last active March 30, 2018 20:37
Plex Log and XML
<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="2" librarySectionTitle="Movies" librarySectionUUID="fc9f5840-a48c-402b-adcf-d5479831903b" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1519709914">
<Video ratingKey="171" key="/library/metadata/171" guid="com.plexapp.agents.imdb://tt0369436?lang=en" librarySectionTitle="Movies" librarySectionID="2" librarySectionKey="/library/sections/2" studio="New Line Cinema" type="movie" title="Four Christmases" contentRating="PG-13" summary="Brad and Kate have made something of an art form out of avoiding their families during the holidays, but this year their foolproof plan is about go bust -- big time. Stuck at the city airport after all departing flights are canceled, the couple is embarrassed to see their ruse exposed to the world by an overzealous television reporter. Now, Brad and Kate are left with precious little choice other than to swallow their pride and suff
@rlaager
rlaager / plex
Created December 28, 2017 03:02
Plex Hook for acmetool
#!/bin/sh
# This script creates a plex.pfx file for use with plexmediaserver.
# Also add plexmediaserver to SERVICES in /etc/default/acme-reload.
# DEBUGGING NOTE: If you make changes to the configuration this will not
# be reflected simply by rerunning 'acmetool', because this script is only
# called when a symlink in 'live' is updated. You can force this script to
# be rerun by deleting all symlinks in 'live' and running 'acmetool'.
#
# modprobe -nv zfs
insmod /lib/modules/4.4.0-101-generic/kernel/zfs/zfs/zfs.ko
# mkdir /lib/modules/$(uname -r)/updates
# cp /lib/modules/$(uname -r)/kernel/zfs/zfs/zfs.ko /lib/modules/$(uname -r)/updates/zfs.ko
# depmod
# modprobe -nv zfs
insmod /lib/modules/4.4.0-101-generic/updates/zfs.ko
@rlaager
rlaager / tdop.py
Created November 11, 2017 03:06
gpsd TDOP test
import gps
gpsd = gps.gps(mode=gps.WATCH_ENABLE)
while True:
x = gpsd.next()
tdop = 0
if 'tdop' in x:
tdop = x['tdop']
print(tdop, gpsd.tdop)
# systemctl stop ntp ; date ; ntpdig -S -j -t 1 69.89.207.199 ; date
Mon Nov 6 19:08:04 CST 2017
{"time":"2017-11-06T19:08:04.789112+0500","offset":0.018044,"precision":0.000507,"host":"69.89.207.199",ip:"69.89.207.199","stratum":2,"leap":"no-leap","adjusted":true}
CLOCK: time stepped by 77497897.000000
Tue Apr 21 19:19:41 CDT 2020
# ntpdig -s -j -t 1 69.89.207.199
{"time":"2017-11-06T19:09:05.150707+0500","offset":0.000038,"precision":0.000524,"host":"69.89.207.199",ip:"69.89.207.199","stratum":2,"leap":"no-leap","adjusted":false}
CLOCK: adj_systime: Invalid argument
$ cat .transifexrc
[https://www.transifex.com]
hostname = https://www.transifex.com
password = REMOVED
token =
username = rlaager
root@rock:/srv/mailman# rsync -nlrtzv -e 'ssh -i /etc/backup_key' [email protected]:/srv/backup/rock.pidgin.im/.zfs/snapshot/20170227T1711Z/data/srv/mailman/archives/ archives2/
receiving incremental file list
private/devel.mbox/devel.mbox
private/devel/
private/devel/index.html
private/devel/pipermail.pck
private/devel/attachments/
private/devel/database/
private/discussion.mbox/discussion.mbox
private/discussion/
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift
leapfile /usr/share/zoneinfo/leap-seconds.list
# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
@rlaager
rlaager / 60-zpool.rules
Created October 15, 2016 09:15
Ubuntu 16.04 ZFS udev Rules
# This creates symlinks directly in /dev with the same names as those in
# /dev/disk/by-id, but only for ZFS partitions. This is necessary for GRUB to
# https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1527727
# https://bugs.launchpad.net/ubuntu/+source/zfs-initramfs/+bug/1530953
# locate the partitions using the output of `zpool status`.
KERNEL=="sd*[0-9]", IMPORT{parent}=="ID_*", ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_TYPE}=="6a898cc3-1dd2-11b2-99a6-080020736631", SYMLINK+="$env{ID_BUS}-$env{ID_SERIAL}-part%n"
KERNEL=="sd*[0-9]", IMPORT{parent}=="ID_*", ENV{ID_FS_TYPE}=="zfs_member", ENV{ID_FS_USAGE}=="raid", SYMLINK+="$env{ID_BUS}-$env{ID_SERIAL}-part%n"
@rlaager
rlaager / bashrc
Last active February 15, 2016 18:00
# Unlike upstream, we use dircolors instead of tput to determine which types of
# terminals support colors. Otherwise, we can end up with an inconsistency
# between bash and ls, et al. For example: a vt100 on OpenIndiana.
if which dircolors > /dev/null 2>&1 && \
dircolors --print-database 2> /dev/null | grep -q "^TERM $TERM$"
then
# Colorize based on hostname: green, yellow, blue, magenta, or cyan.
ps_h='\[\e[1;'$((32 + $(hostname | cut -d. -f1 | cksum | cut -c1-3) % 5))'m\]\h\[\e[0m\]'
if [ "$(id -u)" = "0" ]