Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
# climbing_stats.py - Compute climbing stats from Google location history
#
# Author: Amber Sprenkels <amber@electricdusk.com>
# Date: 2024-03-12
#
# This scripts computes the number of times I went to a local climbing or
# bouldering gym close to where I live, based on my Google location history.
@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 / 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/bash
# install.sh
#
# Installation instruction for getting Ethan's Dilithium code up and running.
#
# Author: Amber Sprenkels <amber@electricdusk.com>
# Date: 17 May 2022
# shellcheck disable=SC2164,SC2155
@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"
#!/usr/bin/env python3
"""
A toy implementation of Shamir's secret sharing scheme in Python
Copyright (c) 2017 Daan Sprenkels <hello@dsprenkels.com>
*Do not use in production code!*
This is a toy implementation. This code is hardened against regular and cache
timing attacks. But Python is a high-level language, and thus not suitable for
#!/bin/sh
# Do a nightly build of LLVM master.
#
# Author: Daan Sprenkels <daan@dsprenkels.com>
set -e
WORKSPACE="$1"
@dsprenkels
dsprenkels / .gitignore
Last active March 30, 2020 09:45
Primitive 512th roots of unity mod q ≈ 2^16; SUPERSEDED BY <https://github.com/mkannwischer/dilithium-m3/blob/master/sage/find_moduli.sage>!
*.py
#!/bin/sh
readonly txtfile="$(mktemp "print-plaintext.XXXXXXXXXX.txt")"
readonly pdffile="${txtfile/.txt/.pdf}"
cat "$@" >"$txtfile"
libreoffice --convert-to "pdf" "$txtfile"
lpr "$pdffile"
#!/bin/sh
readonly OUTPUT_FMT="%(uploader)s [%(upload_date)s] - %(title)s.%(ext)s"
readonly COOKIES_FILE="$(dirname "$0")/.config/cookies.txt"
readonly ONLY_DOWNLOAD_LAST_N="10"
SYNC="0"
if [ "$1" = "sync" ]; then
# Add a channel; i.e. prefill the cache
SYNC="1"