Skip to content

Instantly share code, notes, and snippets.

Stefan Bühler stbuehler

Block or report user

Report or block stbuehler

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@stbuehler
stbuehler / README.md
Created Oct 24, 2019
corretto-jdk repo builder
View README.md

Build debian repo for corretto jdk

Provides a debian repo for corretto jdk (8, but can be modified for 11).

Also provides an "archive" of all older versions.

Needs

  • reprepro
  • wget
@stbuehler
stbuehler / .gitignore
Last active Sep 5, 2019 — forked from markusfisch/README.md
Force any binary to use a specific network interface in Linux
@stbuehler
stbuehler / post-commit
Last active Sep 12, 2018
etckeeper-commit-gpg-mail
View post-commit
#!/bin/sh
# post-commit hook for etckeeper
set -e
recipients=admin@example.com
hostname=$(hostname -f)
git format-patch -1 --subject-prefix="etckeeper ${hostname}" --stdout | safe-mail $recipients
@stbuehler
stbuehler / fstab-uuid.sh
Created Jan 17, 2018
Use UUID instead of block device paths in /etc/fstab
View fstab-uuid.sh
#!/bin/sh
for bdev in $(blkid -o device); do
if [ ! -b "${bdev}" ]; then
echo >&2 "Not a block device: ${bdev}"
continue
fi
uuid=$(blkid -o value -s UUID -- "${bdev}")
# echo "Found UUID '${uuid}' for '${bdev}'"
# block device names hopefully don't contain special shit -.-
@stbuehler
stbuehler / monitor-systemd.sh
Last active May 23, 2019
monitor failed systemd units with cron and send mail
View monitor-systemd.sh
#!/bin/bash
# crontab entry:
# */10 * * * * /usr/local/sbin/monitor-systemd.sh --cron
tmpdir=$(mktemp --tmpdir -d systemd-monitor-XXXXXXX)
trap 'rm -rf "${tmpdir}"' EXIT
sendmail=0
if [ "$1" == "--cron" ]; then
@stbuehler
stbuehler / send.sh
Created Aug 4, 2017
S/MIME test mails send scripts
View send.sh
#!/bin/bash
set -e
tmpdir=$(mktemp --tmpdir -d smime-build-msg-XXXXXXX)
trap 'rm -rf "${tmpdir}"' EXIT
cd "${tmpdir}"
debug_show() {
View totp.rb
#!/usr/bin/env ruby
require 'rotp'
require 'uri'
require 'cgi'
otpuri = STDIN.readline
otpuri = URI(otpuri)
if otpuri.scheme != "otpauth"
@stbuehler
stbuehler / rangealign.sh
Last active Jul 18, 2016
align port range to 2^n start and 2^n-1 size for smallest n
View rangealign.sh
#!/bin/bash
# align port range to 2^n start and 2^n-1 size for smallest n
# call: rangealign.sh a-b
a=${1%-*}
b=${1##*-}
dist=$((b-a))
n=2
while [ $dist -ge $((2**n)) ]; do
((++n));
@stbuehler
stbuehler / open-xchange-nginx.conf
Created Jul 9, 2016
Open-Xchange nginx config
View open-xchange-nginx.conf
# route balancing only in commercial edition...
#map $cookie_JESSIONID $route_cookie1 {
# ~.+\.(?P<route>\w+)$ $route;
#}
#map $cookie_jsessionid $route_cookie2 {
# ~.+\.(?P<route>\w+)$ $route;
#}
#map $request_uri $route_uri1 {
# ~JSESSIONID=.+\.(?P<route>\w+)$ $route;
#}
View cups-ppd-source.sh
#!/bin/sh
# Find model names current PPDs were installed from
set -e
tmpdir=$(mktemp --tmpdir -d cups-ppd-source-XXXXXXX)
trap 'rm -rf "${tmpdir}"' EXIT
ppd_updater () {
You can’t perform that action at this time.