Skip to content

Instantly share code, notes, and snippets.

View dmuth's full-sized avatar
💭
White Mage

Douglas Muth dmuth

💭
White Mage
View GitHub Profile
#!/bin/bash
#
# Download a copy of Anthrocon's website, with (hopefully) working links,
# and tar it up to a single file.
#
# Errors are fatal
set -e
@dmuth
dmuth / backup-website
Created January 26, 2019 03:26
A shell script to back up an entire website with wget
#!/bin/bash
#
# Download a copy of a website, with (hopefully) working links,
# and tar it up to a single file.
#
# Errors are fatal
set -e
@dmuth
dmuth / tail.py
Created October 16, 2021 22:47
A Python script that mimics tail -f in Linux
#!/usr/bin/env python3
#
# This script will mimic tail -f functionality in Python.
# It will correctly handle files that haven't been created yet, as well as files that are removed.
#
# It is based heavily on an example I found at:
# https://newbedev.com/how-can-i-tail-a-log-file-in-python
#
# However, I did some optimization. :-)
#
@dmuth
dmuth / append-to-etc-hosts-in-vm.sh
Created January 16, 2022 00:36
How to create multiple Multipass Ubuntu instances with name resolution between them using a custom /etc/hosts file
#!/bin/bash
#
# This script should run in a multipass VM.
# Take the hosts file that was written at creation and append it to /etc/hosts.
# This way, the hosts that we created can talk to each other by hostname.
#
# Errors are fatal
set -e
@dmuth
dmuth / convert-files-to-heic-recursive.sh
Last active May 9, 2023 14:44
Shell script to recursively convert JPG and PNG files to HEIC format.
#!/bin/bash
#
# This script will convert JPG and PNG files to HEIC format recursively.
#
# Errors are fatal
set -e
GO=""
DELETE=""
#!/bin/bash
#
# This script is to test specific Autobahn jumphosts.
#
# Errors are fatal
set -e
#
#!/bin/bash
#
# This script is to test specific Autobahn jumphosts.
#
# Errors are fatal
set -e
#set -x # Debugging
@dmuth
dmuth / js-main.html
Created April 2, 2024 00:15
Painless Concat with Hugo
{{/*
I'm using Hugo to build the front end for https://github.com/dmuth/peco-outage-status
As part of that effort, I'd like to be able to have separate Javascript files thare combined into
a single Javascript file when I build the site.
The good news is that the Concat function in Hugo lets me do this. The bad news is that the key
is the filename, and the contents are cached. This does not lend itself well to rapid development.
So the trick was to create a filename based on the date so that each time a file is edited and Hugo
re-processes its files, a new filename is generated, which results in a cache miss in Concat,