Skip to content

Instantly share code, notes, and snippets.

@chris2k20
chris2k20 / docker-mysql-mariadb-upgrade-docker-container.sh
Last active June 12, 2022 20:21
Run a mysql_upgrade in all mysql/mariadb docker containers
# run the following command in your terminal to:
# - run a mysql_upgrade command in every container
# - kill the container to restart the mariadb
for x in $(docker ps | grep -i mariadb:latest | awk '{print $1;}'); do echo container $x now updating...; docker exec $x bin/sh -c 'mysql_upgrade --user=root --password=$(printenv MYSQL_ROOT_PASSWORD) ; kill 1'; done
@chris2k20
chris2k20 / Proxmox-Cloudinit-Ubuntu-20.10.sh
Last active November 3, 2022 00:36
Proxmox-Cloudinit-Ubuntu-20.10.sh
#!/bin/bash
# Creats a Ubuntu 20.10 Cloud-Init Ready VM Template in Proxmox
#
# Ubuntu 20.04: https://gist.github.com/chris2k20/dba14515071bd5a14e48cf8b61f7d2e2
# Ubuntu 20.10: https://gist.github.com/chris2k20/181ef4e4308e678657459d40ea94af90
export IMAGENAME="groovy-server-cloudimg-amd64.img"
export IMAGEURL="https://cloud-images.ubuntu.com/groovy/current/"
@chris2k20
chris2k20 / Proxmox-Cloudinit.sh
Last active April 21, 2024 13:20
Proxmox Cloud-Init Template Creation Bash-Script (Ubuntu)
#!/bin/bash
# Creates a Ubuntu Cloud-Init Ready VM Template in Proxmox
#
# Update the image name and URL for Ubuntu 22.04 LTS
export IMAGENAME="jammy-server-cloudimg-amd64.img"
export IMAGEURL="https://cloud-images.ubuntu.com/jammy/current/"
export STORAGE="local-zfs-cache"
export VMNAME="ubuntu-2204-cloudinit-template"
export VMID=902204
@chris2k20
chris2k20 / wildcard
Created November 4, 2020 08:35
wildcard
*
@chris2k20
chris2k20 / wg-create-user.sh
Created October 29, 2020 14:30
Automate creation of a Wireguard User Key, Public-Key, PSK
#!/bin/bash
# Usage: ./wg-create-user.sh my-user
# Creats wiregard key, pub, psk
# Read vars
read -p "Client name: " -e -i $1 CLIENT
# Test vars, files
if [[ "$CLIENT" = "" ]]; then
echo "Sorry, you need a Client-Name"
exit 2
@chris2k20
chris2k20 / ssh-multi.sh
Created May 1, 2020 12:04 — forked from pstray/ssh-multi.sh
Start tmux and ssh to multiple hosts with synchronized input
#! /bin/bash
if [ -z "$1" ]; then
echo "please supply at least one server to connect to" >&2
exit 1
fi
target=multi-ssh-$$
if [ -z "$TMUX" ]; then