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
@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,
#!/bin/bash
#
# This script is to test specific Autobahn jumphosts.
#
# Errors are fatal
set -e
#set -x # Debugging
#!/bin/bash
#
# This script is to test specific Autobahn jumphosts.
#
# 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=""
@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 / 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 / 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
#!/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

Keybase proof

I hereby claim:

  • I am dmuth on github.
  • I am dmuth (https://keybase.io/dmuth) on keybase.
  • I have a public key ASA3KPZ_mYWvzsYrN2KCqpRjY30CPUy1ZCuc_3CWhB1yIwo

To claim this, I am signing this object:

@dmuth
dmuth / s3-undelete.sh
Created December 11, 2016 21:40
Script to undelete files from Amazon S3
#!/bin/bash
#
# This script can be used to undelete objects from an S3 bucket.
# When run, it will print out a list of AWS commands to undelete files, which you
# can then pipe into Bash.
#
# e.g.: s3-undelete.sh <options> > files.txt; cat files.txt | bash
#
# You will need the AWS CLI tool from https://aws.amazon.com/cli/ in order to run this script.
#