Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
PUPPETFILE=/puppet/Puppetfile
MODULEDIR=/puppet/modules/
PUPPET=/opt/puppetlabs/bin/puppet
MODULES=( `cat ${PUPPETFILE} | grep mod | awk ' { print $2 } ' | tr -d \' | tr -d , | tr -d \"` )
for MODULE in "${MODULES[@]}"
do
@DougBarry
DougBarry / timespan-to-human-readable-string.cs
Created November 2, 2021 16:04
C# Timespan to human readable string extension method
# Based on https://stackoverflow.com/a/41966914
public static class ExtensionMethods
{
public static string ToHumanReadable(this TimeSpan timeSpan)
{
Func<Tuple<int, string>, string> tupleFormatter = t => $"{t.Item1} {t.Item2}{(t.Item1 == 1 ? string.Empty : "s")}";
var components = new List<Tuple<int, string>>
{
Tuple.Create((int) timeSpan.TotalDays, "day"),
@DougBarry
DougBarry / wifi_mac_randomiser.sh
Created August 31, 2022 17:21
OpenWRT randomise access point MAC addresses
#!/bin/sh
get_random_mac () {
echo $(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | md5sum | sed -e 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\
}
for networkid in $(uci show wireless | grep wifinet | cut -d "." -f2 | uniq | grep -v -E wifi-iface)
do
uci set wireless.${networkid}.macaddr=$(get_random_mac)
done
# This is the configuration file for DOSBox DOSBox-X. (Please use the latest version of DOSBox)
# Lines starting with a # are comment lines and are ignored by DOSBox.
# They are used to (briefly) document the effect of each option.
# To write out ALL options, use command 'config -all' with -wc or -writeconf options.
[log]
# logfile: file where the log messages will be saved to
# vga: Enable/Disable logging of this type.
# Possible values: true, false, debug, normal, warn, error, fatal, never.
# vgagfx: Enable/Disable logging of this type.