Skip to content

Instantly share code, notes, and snippets.

@dsprenkels
dsprenkels / mpd-alarm
Last active November 21, 2023 06:30
MDP alarm
#!/bin/bash
# Copyright 2015 Daan Sprenkels <dsprenkels@gmail.com>
export MPD_HOST="$MPD_PASSWD@localhost"
export MPD_PORT=6600
PLAYLISTS_DIR="/var/lib/mpd/playlists"
# Don't activate if we are already playing music
#!/bin/sh
if ["$IFACE" != "wlan0"]; then
exit 0
fi
if ["$MODE" != "start"]; then
exit 0
fi
@dsprenkels
dsprenkels / firewall.sh
Last active May 10, 2021 21:53
firewall configuration of my personal VPS
#!/bin/sh
# CHANGELOG
#
# [2015-12-21 Daan] Basic /etc/firewall.sh configuration
# This configuration is based on the whitelist principle, in contrast to the
# previous configuration, which only dropped packets based on specific rules.
# make iptables wait for exclusive lock always
IPTABLES="/sbin/iptables -w"
@dsprenkels
dsprenkels / fosdem_noprint_headerfooter.user.js
Last active January 12, 2016 13:15
a userscript that hides the header and footer when "media: print" on fosdem.org
// ==UserScript==
// @name fosdem.org: hide header/footer in "media: print"
// @namespace com.dsprenkels.fosdem_bprint
// @include https://fosdem.org/*
// @version 1
// @grant none
// ==/UserScript==
var elem = document.createElement("style");
elem.setAttribute("type", "text/css");
@dsprenkels
dsprenkels / check_revision.sh
Last active June 24, 2016 21:38
git-bisect script example
#!/bin/sh
# build initially and skip if this build is broken
./configure --enable-ccache --enable-debug
make -j3 check-stage1-TSUITE || (make clean; rm -rf ./x86_64-unknown-linux-gnu/ dist/ dl/ tmp/; exit 125)
# deploy our regression test
cp issue-XXX.rs src/test/TESTSUITE/
# run the regression test suite
@dsprenkels
dsprenkels / peage-print
Last active May 12, 2017 20:18
script for easy printing to Péage from lilo @ Radboud University
#!/bin/bash
# Author: Daan Sprenkels <dsprenkels@science.ru.nl>
# Description: script for easy printing to Péage from lilo
PROGNAME="peage-print"
VERSION="0.1.2 (2016-08-30)"
PRINT_SERVER="payprint01.ru.nl"
PRINT_QUEUE="RU-Print"
SNUMBER_CACHE_FILE="$HOME/.cache/snumber.txt"

Keybase proof

I hereby claim:

  • I am dsprenkels on github.
  • I am dsprenkels (https://keybase.io/dsprenkels) on keybase.
  • I have a public key whose fingerprint is 951D 6F6E C19E 5D87 1A61 A7F4 1445 C075 FFD5 68CD

To claim this, I am signing this object:

@dsprenkels
dsprenkels / piwik_install.sh
Created January 16, 2017 18:15
install script for piwik
#!/bin/sh
set -e
WGET="wget --quiet"
URL="http://example.com/piwik/index.php"
# make sure that these values are correctly url-encoded!
MYSQL_DB="piwik"
MYSQL_USER="piwik"
@dsprenkels
dsprenkels / imapscrape.py
Created January 20, 2017 15:52
example script for scraping IMAP mailboxes
#!/usr/bin/env python3
import getpass
import email
import imaplib
HOST = 'dsprenkels.com'
USER = 'hello@dsprenkels.com'
PASSWD = getpass.getpass()
MAILBOX = 'Voorraadcie.Reserveringen'
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
products = [
(r'(kratten )?bier', 'bier'),
(r'flessen rode wijn|rood|rode wijn', 'rood'),
(r'(flessen witte wijn )?zoet|zoete witte wijn', 'zoet'),
(r'(flessen witte wijn )?droog|droge witte wijn', 'droog'),