Skip to content

Instantly share code, notes, and snippets.

View PhrozenByte's full-sized avatar

Daniel Rudolf PhrozenByte

View GitHub Profile
@PhrozenByte
PhrozenByte / PicoAssetsModPlugin.php
Created July 14, 2019 12:08
A simple Pico plugin registering a Twig filter to add a asset's modification time. Pico is a stupidly simple, blazing fast, flat file CMS. http://picocms.org/
<?php
/**
* Pico assets modification time plugin
*
* Registers a Twig filter to add a asset's modification time. Pass a path
* to a file and it will return its corresponding URL with a time suffix.
*
* Example:
*
@PhrozenByte
PhrozenByte / munin-plugin.disks_
Last active April 24, 2019 02:05
Wildcard munin plugin to monitor filesystem usage
#!/bin/bash
: << =cut
=head1 NAME
disks_ - Wildcard plugin to monitor filesystem usage
=head1 CONFIGURATION
This plugin does not normally require configuration. However, you can tweak its
@PhrozenByte
PhrozenByte / munin-plugin.statefile-helper
Last active April 7, 2022 20:05
Munin statefile support functions for munin shell plugins
# -*- sh -*-
# Munin statefile support functions for munin shell plugins
#
: << =cut
=head1 NAME
plugin-statefile.sh - Munin statefile support functions for munin shell plugins
=head1 AUTHOR
@PhrozenByte
PhrozenByte / xbrightness
Created March 30, 2019 14:44
Zenity dialog to set screen brightness using xrandr
#!/bin/bash
export LC_ALL=C
readarray -t SCREENS < <(xrandr --listmonitors | grep "^ [0-9]\+: " | cut -d ' ' -f 6)
[[ ${#SCREENS[@]} > 0 ]] || exit 1
CURBRIGHT="$(xrandr --current --verbose | awk 'on { if ($0 ~ /^\tBrightness: /) { print $2 } else if ($0 ~ /^\t/) { next } exit } /^[[:graph:]]+ connected primary/ { on=1 }')"
[ -n "$CURBRIGHT" ] && CURBRIGHT="$(bc 2> /dev/null <<< "scale=0; ($CURBRIGHT * 100)/1")" || CURBRIGHT=100
function setbright {
@PhrozenByte
PhrozenByte / gtk-icon-path
Created March 30, 2019 14:35
Returns the full path to a Gtk icon file by icon name
#!/usr/bin/env python3
import os, sys
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
if len(sys.argv) < 2:
sys.stderr.write("Usage:\n")
@PhrozenByte
PhrozenByte / munin-plugin.nc_port
Created February 11, 2019 15:29
Munin plugin to probe TCP and UDP ports
#!/bin/bash
: << =cut
=head1 NAME
nc_port - Plugin to monitor TCP/UDP port connectivity
=head1 CONFIGURATION
@PhrozenByte
PhrozenByte / # borg-unattended.md
Last active January 12, 2020 17:45
Shell scripts to run Borg backups unattended

borg-unattended

Shell scripts to run Borg backups unattended.

Install

# backup script
@PhrozenByte
PhrozenByte / # hetzner-snapshot.md
Last active May 14, 2022 21:50
Shell script to create a snapshot of a Hetzner CX line virtual server

hetzner-snapshot

Shell script to create a snapshot of a Hetzner CX line virtual server.

Install

# script
@PhrozenByte
PhrozenByte / all-inkl.md
Last active February 6, 2024 07:47
Dokumentation der Statistikoptionen von (Sub-)Domains bei all-inkl.com

all-inkl.com Access Logs & Webalizer

Leider ist die Dokumentation der verschiedenen Statistikoptionen bei all-inkl.com ziemlich unvollständig und der Tooltip im KAS wenig hilfreich. Insbesondere welchen Einfluss die verschiedenen Optionen auf die Access Logs nehmen ist komplett undokumentiert. Der Einfluss auf die Access Logs ist dabei aber wichtig um zu verstehen welche Zugriffe in den Webalizer-Statistiken erfasst werden.

Access Logs

  • Logs A: Zugriffe werden in logs/access_log_[Datum].gz des Rootverzeichnisses geloggt.
  • Logs B: Zugriffe werden in logs/access_log_[Datum].gz des Domainpfades geloggt.
@PhrozenByte
PhrozenByte / HeadersEqual.pm
Created September 8, 2016 16:03
Compare message headers against each other with SpamAssassin
# <@LICENSE>
# Copyright 2016 Daniel Rudolf <www.daniel-rudolf.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software