Skip to content

Instantly share code, notes, and snippets.

View JohnMertz's full-sized avatar

John Mertz JohnMertz

View GitHub Profile
@JohnMertz
JohnMertz / bootc-ovh.md
Created July 4, 2025 19:23
Install a BootC image on OVH

Installing a BootC image on OVH

OVH does not provide any OS versions which natively use bootable container images, however it is possible to replace an existing OS.

WARNING

This will overwrite the system which it is installed on. It is recommended to do this on a brand new VPS or one that you have absolutely no use for.

Install a fresh VPS

@JohnMertz
JohnMertz / tangerine.pl
Last active June 17, 2024 17:35
Tangerine Investment Fund Scraper/Export Tool
#!/usr/bin/perl
# This script fetches the performance data for various Tangerine Bank investment funds and exports them to:
# - CSVs called <fund_name>.csv with all historical data in format: "YYYY-MM-DD","12.34"
# - (optional) A single JSON file with trend data: {"Fund Name":{"0":12.34,"1":"12.56"...},"Fund Name":...}
# - (optional) PNG line chart
# All data is publicly available from: https://www.tangerine.ca/en/products/investing/performance
# This is just a handy way to use the data locally for various purposes.
#
# Should be run daily Tuesday-Saturday, such as with cron:
@JohnMertz
JohnMertz / net.pl
Created April 10, 2020 11:30
Script to get network interfaces as nested hashes
#!/usr/bin/perl
use strict;
use warnings;
my $addr = `ip addr`;
my %links;
my $current;
foreach (split '\n', $addr) {
@JohnMertz
JohnMertz / dialpad.pl
Created April 10, 2020 11:53
Translate letters to dialpad numbers and numbers to possible words
#!/usr/bin/perl
# TODO: at the moment, words are only broken up by 0 and 1. Should search for smaller sequential words. For example:
# 6908378 finds: mytest
# but 1698378 does not
use strict;
use warnings;
# Default Debian ispell dictionary
@JohnMertz
JohnMertz / blc.pl
Created April 10, 2020 11:25
Intel backlight control script
#!/usr/bin/perl -w
# Files containing current and max brightness values
my $cur_file = "/sys/class/backlight/intel_backlight/brightness";
my $max_file = "/sys/class/backlight/intel_backlight/max_brightness";
# About (See help() for more):
# Script to read and write to the backlight brightness file. Allows for easy control of the backlight without a proper backlight daemon (eg. when logged in to a console).
# Requires ownership/permissions for the brightness file. This can be automatically acquired with the following SystemD Unit:
@JohnMertz
JohnMertz / rem2json.pl
Last active July 8, 2022 01:07
Convert `remind -p` output to JSON
#!/usr/bin/perl
use strict;
use warnings;
use constant MONTH => sub{{
'January' => 1,
'February' => 2,
'March' => 3,
'April' => 4,
@JohnMertz
JohnMertz / multiscan.pl
Created January 20, 2021 18:24
Scan and automatically crop many images with SANE and ImageMagick
#!/usr/bin/perl
use strict;
use warnings;
use POSIX ":sys_wait_h";
STDOUT->flush();
use File::Which qw( which );
foreach ( qw| convert scanimage | ) {
@JohnMertz
JohnMertz / stream_podcasts.pl
Created November 24, 2020 09:37
Daily podcast player
#!/usr/bin/perl
use strict;
use warnings;
# Dependencies
use LWP::UserAgent; # Usually pre-installed, available on CPAN
use XML::Hash::XS; # CPAN or libxml-hash-xs-perl on Debian
# Feeds that should be used if no arguments are provided
@JohnMertz
JohnMertz / sway_displays.pl
Last active August 27, 2020 17:01
Automatically configure display layout and waybar for Sway
#!/usr/bin/perl
########################################################################
# Dependencies
########################################################################
#
# Depends on JSON::XS and Proc::ProcessTable
#
# Debian:
# apt install libjson-xs-perl libproc-processtable-perl
@JohnMertz
JohnMertz / minecraft.service
Last active August 17, 2020 02:45
Minecraft SystemD Unit File
[Unit]
Description=Minecraft
After=network.target
[Service]
Type=simple
User=minecraft
Group=minecraft
WorkingDirectory=/var/lib/minecraft/current
ExecStart=java -jar -Xmx2G -Xms1G server.jar --nogui