Skip to content

Instantly share code, notes, and snippets.

View PhrozenByte's full-sized avatar

Daniel Rudolf PhrozenByte

View GitHub Profile
@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 / pavol
Last active March 30, 2019 14:45
Zenity dialog to set audio volume using PulseAudio
#!/bin/bash
SINK="$(pacmd list-sinks | awk '/* index: [0-9]+/{ print $3 }')"
# current volume snippet taken
# from pulseaudio-ctl <https://github.com/graysky2/pulseaudio-ctl>
# by graysky <graysky@archlinux.us>, licensed under MIT
CURVOL="$(pacmd list-sinks | grep -A 15 '* index' | awk '/volume: /{ print $3 }' | grep -m 1 % | sed 's/[%|,]//g')"
[ -n "$CURVOL" ] || CURVOL="$(pacmd list-sinks | grep -A 15 '* index' | awk '/volume: front/{ print $5 }' | sed 's/[%|,]//g')"
[ -n "$CURVOL" ] || CURVOL=100
@PhrozenByte
PhrozenByte / munin-plugin.vimbadmin_count
Last active April 11, 2019 19:49
Munin plugins for ViMbAdmin
#!/usr/bin/env php
<?php
/**
* ViMbAdmin munin plugin
* Version 2.4 (build 20190411)
*
* SHORT DESCRIPTION:
* Monitors the number of domains, mailboxes and aliases.
*
* DEPENDENCIES:
@PhrozenByte
PhrozenByte / cron.d.vimbadmin-mb-size
Last active April 11, 2019 20:02
Update ViMbAdmin mail and home size using Dovecots quota dict
#
# /etc/cron.d/vimbadmin-mb-size
# schedules periodic execution of vimbadmin-mb-size script
#
# m h d m w user command
*/5 * * * * root [ -x /usr/local/bin/vimbadmin-mb-size ] && /usr/local/bin/vimbadmin-mb-size --database "vimbadmin" --quota-table "quota"
@PhrozenByte
PhrozenByte / VBoxGuestRun.bat
Last active April 11, 2019 20:31
Runs applications inside a VirtualBox VM (VBoxGuestRun.bat) and toggles a VirtualBox VM on/off (VBoxToggle.bat)
@echo off & setlocal
REM Runs applications inside a VirtualBox VM
REM Version 1.1 (build 20160904)
REM
REM Copyright (C) 2016 Daniel Rudolf <www.daniel-rudolf.de>
REM
REM This program is free software: you can redistribute it and/or modify
REM it under the terms of the GNU General Public License as published by
REM the Free Software Foundation, version 3 of the License only.
@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 / 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 / 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 / # 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 / 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,