Skip to content

Instantly share code, notes, and snippets.

View lucaswerkmeister's full-sized avatar

Lucas Werkmeister lucaswerkmeister

View GitHub Profile
# /etc/systemd/system/opendkim.service
[Unit]
Description=OpenDKIM email sender authentication system
Documentation=man:opendkim(8) man:opendkim.conf(5) http://www.opendkim.org/
After=network.target nss-lookup.target
[Service]
RuntimeDirectory=opendkim
Type=forking
PIDFile=/run/opendkim/opendkim.pid
@lucaswerkmeister
lucaswerkmeister / weak-gpg-sigs
Last active February 23, 2017 17:33
Print weak signatures of your PGP keys (with GnuPG)
#!/bin/bash
# source: https://www.gnupg.org/documentation/manuals/gpgme/Hash-Algorithms.html
digests=(
nil
MD5
SHA1
RMD160
MD2
TIGER
@lucaswerkmeister
lucaswerkmeister / ceylond.md
Last active January 20, 2017 08:57
ceylond announcement

Introducing ceylond and cformat

Good ``timeofday`` everyone! It is with great pleasure that I announce the release of four new Ceylon modules, grouped together as the [ceylond] project, as well as a companion program, [cformat]. This email introduces the motivation behind them, how they work, and what they do in detail.

TL;DR

@lucaswerkmeister
lucaswerkmeister / instructions.md
Last active December 24, 2016 16:46
Make your Arch Linux device emit ownership information on boot

Make your Arch Linux device emit ownership information on boot

Scenario: You’ve lost your device. Actually Honest Achmed finds it, and would like to return it to you. However, the label that you had carefully attached to your device was ripped off. How does Achmed know who to return the device to? He attempts to boot the device, but since you use full-disk encryption (you do use full-disk encryption, don’t you?), that doesn’t get him any further than the decryption password prompt. Fortunately, you have arranged for a simple message to be printed before that prompt,

@lucaswerkmeister
lucaswerkmeister / opendmarc.service
Last active December 15, 2016 12:19
systemd configuration files for OpenDMARC
# /etc/systemd/system/opendmarc.service
[Unit]
Description=OpenDMARC email validation system
Documentation=man:opendmarc(8) man:opendmarc.conf(5) man:opendmarc-import(8) man:opendmarc-reports(8) http://www.trusteddomain.org/opendmarc/
After=network.target nss-lookup.target
[Service]
RuntimeDirectory=opendmarc
Type=forking
PIDFile=/run/opendmarc/opendmarc.pid
@lucaswerkmeister
lucaswerkmeister / pipeline.sh
Created December 11, 2016 14:29
Days on which Postfix sent most outgoing emails
journalctl -u postfix -o json | jq -r 'select(.MESSAGE | contains("to=")) | .["_SOURCE_REALTIME_TIMESTAMP"]' | awk '{sec=int($1/(1000*1000)); print sec, int(sec/(60*60*24))}' | uniq -f 1 -c | sort -rn | head | while read count stamp day; do printf '%s\t%s\n' "$count" "$(date -Idate -d @$stamp)"; done
@lucaswerkmeister
lucaswerkmeister / var.tex
Last active November 27, 2016 18:40
Make ? indicate a single-letter variable in math mode
\documentclass{article}
\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{3BB}{\lambda} % λ
\newcommand{\var}[1]{\mathtt{#1}}
\let\qm=?
\catcode`?=13
\def?{%
@lucaswerkmeister
lucaswerkmeister / cul.sty
Created November 27, 2016 17:42
Colored underline, with Beamer overlay support
% colored underline, with Beamer overlay support
% usage: \cul{x} or \cul[blue]{x} or \cul<2->{x} or \cul<2->[blue]{x}
\newcommand<>{\cul}[2][red]{%
import ceylon.language.meta.model {
ClassOrInterface
}
shared interface Enumeration<Element> of Element
given Element satisfies Enumeration<Element> {
shared static Element? byName(String name) {
assert (is ClassOrInterface<Element> coi = `Element`);
return coi.caseValues.find((element) => name == element.name);
}
@lucaswerkmeister
lucaswerkmeister / make-orphan.sh
Created October 28, 2016 11:37
Rough sketch on how to turn a Git branch into an orphan branch
branch=... # the branch you want to turn into an orphan branch
base=master # the branch which $branch is based on and shouldn’t be anymore
firstCommit=... # the first commit on $branch that’s not on $base
# rename $branch to $branch-bak
git checkout $branch
git checkout -b $branch-bak
git branch -d $branch
# new orphan $branch