Skip to content

Instantly share code, notes, and snippets.

View PhrozenByte's full-sized avatar

Daniel Rudolf PhrozenByte

View GitHub Profile
@PhrozenByte
PhrozenByte / 6to4-daemon
Created April 22, 2020 12:06
Establishing an IPv6 tunnel using 6to4
#!/bin/bash
# 6to4-daemon - Establishing an IPv6 tunnel using 6to4
# Copyright (C) 2011 Daniel Rudolf <http://www.daniel-rudolf.de/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@PhrozenByte
PhrozenByte / gta-empty-lobby.ps1
Created January 11, 2020 19:47
Creates a empty public lobby in Grand Theft Auto Online.
# Creates a empty public lobby in Grand Theft Auto Online.
# by Daniel Rudolf <https://github.com/PhrozenByte>
#
# This PowerShell v3+ script suspends `GTA5.exe` for 8 seconds, causing
# GTA Online to create a empty public lobby. For undisturbed fun
# without modders, griefers and other pathetic pip-squeaks.
#
# License:
# Creative Commons CC0
# <https://creativecommons.org/publicdomain/zero/1.0/deed>
@PhrozenByte
PhrozenByte / FigureExtParsedown.php
Created September 2, 2019 15:01
A simple Pico plugin to wrap Markdown images in <figure> elements. Pico is a stupidly simple, blazing fast, flat file CMS. http://picocms.org/
<?php
/**
* Parsedown figure extension
*
* Parsedown extension to wrap single-image lines in <figure>, not <p>.
*
* @author Krzysztof Antoniak
* @link https://gist.github.com/kantoniak/b1a5c7889e5583824487dc78d93da7cd
* @license Public Domain
@PhrozenByte
PhrozenByte / PicoPageModPlugin.php
Created July 14, 2019 12:21
A simple Pico plugin adding a page's last modification time to its page data. Pico is a stupidly simple, blazing fast, flat file CMS. http://picocms.org/
<?php
/**
* Pico page modification time plugin
*
* Adds a page's last modification time to its page data.
*
* Example:
*
* ```twig
@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