Skip to content

Instantly share code, notes, and snippets.

View Kline-'s full-sized avatar

Matthew Goff Kline-

  • 11:15 (UTC -06:00)
View GitHub Profile
@Kline-
Kline- / visio_toggle.vba
Last active October 11, 2022 15:18
Visio multi-layer visibility toggle
' Visio objects attached to more than one layer will stay visible as long as any layer they are a member of is visible.
' This was undesireable behavior for the drawing I was creating and this is the solution I came up with. Suggestions and
' improvements are welcome as I rarely touch VBA code and prior to last week had only ever used Visio for about 5 minutes :)
' The ToggleLayer sub will toggle the visibility of a named layer in Visio. After updating the layer visibility it
' then calls the UpdateShapes sub to iterate through all objects and show/hide them by setting
' Geometry1.NoShow and Misc.HideText values based on the layer visibility.
Option Explicit
@Kline-
Kline- / image-check.sh
Created October 21, 2021 11:32
Check docker hub for image updates. Adapted from: https://mlohr.com/check-for-docker-image-updates/
#!/bin/bash
VERBOSE=false
ec() {
if $VERBOSE; then echo -en $1; fi
}
for IMAGE in $(docker images | grep -v '^REPOSITORY' | cut -f1 -d' ')
do
ec "Fetching Docker Hub token...\n"
@Kline-
Kline- / anti_idle.vbs
Created December 28, 2021 13:38
Prevent Windows screensaver and idle timer from activating.
Set objShell = WScript.CreateObject("WScript.Shell")
Do While True
objShell.SendKeys("{SCROLLLOCK}")
WScript.Sleep(100)
objShell.SendKeys("{SCROLLLOCK}")
WScript.Sleep(24000)
Loop
@Kline-
Kline- / backup-mariadb.sh
Last active September 5, 2023 17:22
Backup MariaDB data running in a Docker container
#!/bin/bash
BASE=`date -I`-mariabackup
CONT=mariadb
DEST=/home/matt/_gdrive/mariabackup/
MAGE=365
OWNER=matt:matt
TGZ=$DEST$BASE.tgz
# check if the container is running
if [ "$( docker container inspect -f '{{.State.Running}}' $CONT )" == "true" ]; then
@Kline-
Kline- / deb-nvidia-headless.txt
Created January 3, 2024 02:58
Debian NVIDIA driver install for headless server
The current nvidia-driver package in Debian 12 is designed for desktop systems and has dependencies to install Xorg
and other desktop packages. There is no package similar to the nvidia-headless package provided by Ubuntu. These were
the minimal packages (and their dependencies) I had to install to get a Quadro P400 running on a headless Debian 12
box for transcoding use.
install dkms nvidia-kernel-dkms libnvcuvid1 libnvidia-encode1 nvidia-smi linux-headers-amd64 nvidia-driver-bin
rmmod nouveau
modprobe nvidia
@Kline-
Kline- / wg.sh
Last active August 30, 2024 13:53
A wrapper for the wireguard command to display the hostname of endpoints from local DNS.
#!/bin/bash
WG=/usr/bin/wg
WGCONF=/etc/wireguard/wg0.conf # The line prior to AllowedIPs in each [Peer] should be # Name = Xyz
OUTPUT=$(script --flush --quiet /dev/null --command $WG)
if [[ $# -gt 0 ]]; then
$WG $@
exit
fi
if [[ ! -z $OUTPUT ]]; then
@Kline-
Kline- / docker-hc.service
Created June 24, 2024 20:08
Restart unhealthy docker containers.
[Unit]
Description=docker-hc
Wants=docker-hc.timer
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/docker-hc.sh
User=root
Group=root
@Kline-
Kline- / pythond.sh
Created June 25, 2024 22:07
A wrapper for running arbitrary Python scripts inside a docker container.
#!/bin/bash
#Need to attach to a docker network for pip to function
NET=docker_bridge
if [[ -f "requirements.txt" ]]; then
docker run --network $NET -it --rm -v "$PWD":/usr/src/app -w /usr/src/app python:3 sh -c "python -m pip --disable-pip-version-check -qqq install -r requirements.txt ; python $*"
else
docker run --network $NET -it --rm -v "$PWD":/usr/src/app -w /usr/src/app python:3 python $@
fi
@Kline-
Kline- / OpenWRT.dockerfile
Created September 29, 2024 13:03
A dockerfile to setup an OpenWRT build environment. Update the VERS var as needed.
FROM debian:stable
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y \
sudo time git-core subversion build-essential gcc-multilib \
libncurses5-dev zlib1g-dev gawk flex gettext wget unzip \
grep rsync python3 python3-distutils file && \
apt-get clean