Skip to content

Instantly share code, notes, and snippets.

View PhrozenByte's full-sized avatar

Daniel Rudolf PhrozenByte

View GitHub Profile
@PhrozenByte
PhrozenByte / PicoRedirect.php
Last active November 17, 2021 21:59
A simple Pico plugin to create redirection pages to arbitrary URLs.
<?php
/**
* Pico redirect plugin
*
* Adds a `Redirect` meta header to redirect to other URLs. The meta header
* supports URL substitution variables, namely %base_url%, %plugins_url%,
* %themes_url%, %assets_url% and %theme_url%.
*
* Example:
@PhrozenByte
PhrozenByte / coverage-badge.sh
Created January 28, 2021 01:32
Creates a coverage.svg badge from a clover.xml.
#!/bin/bash
# coverage-badge.sh - Creates a coverage.svg badge from a clover.xml.
#
# Copyright (C) 2021 Daniel Rudolf (<https://www.daniel-rudolf.de>)
# License: The MIT License <http://opensource.org/licenses/MIT>
#
# SPDX-License-Identifier: MIT
function print_usage {
echo "Usage:"
@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 / MPDO.php
Created January 18, 2016 18:36
MPDO - a "magical" extension to PHP's PDO with features, a programmer could miss sorely when using PDO.
<?php
namespace PhrozenByte\MPDO;
use PDO;
use PhrozenByte\MPDOStatement;
use RuntimeException;
/**
* The MPDO class
*
@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 / 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 / # 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 / 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 / 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