Skip to content

Instantly share code, notes, and snippets.

View t11z's full-sized avatar
😁
happy

Thomas Sprock t11z

😁
happy
View GitHub Profile
@t11z
t11z / Hyper-V VM Auto Control Script.md
Last active September 6, 2025 13:06
Run your home lab on Hyper-V during business hours and shut it down in your free time

Hyper‑V VM Auto‑Control Script

Overview

This PowerShell script automatically manages the running state of specific Hyper‑V virtual machines based on a defined work schedule.
It ensures that the listed VMs are running during business hours (Monday–Friday, 08:00–17:00) and stopped outside of those hours — with one important exception:

If a VM is manually started outside the scheduled period (e.g., via Hyper‑V Manager or another PowerShell session), the script will detect this and keep it running until the next scheduled start period. This prevents unwanted shutdowns of manually started VMs.

The script also:

  • Logs all actions to the Windows Event Log (Application log, source: HyperV-AutoControl).
@t11z
t11z / fiber_optics_cabling_cheat_sheet.md
Last active February 18, 2025 08:41
Fiber Optics Cabling Cheat Sheet

Fiber Optics Cabling Cheat Sheet

Multimode vs. Singlemode Fiber

Property Multimode (OM1, OM2, OM3, OM4, OM5) Singlemode (OS1, OS2)
Core Diameter 50 µm (OM3/OM4/OM5), 62.5 µm (OM1) 8-9 µm
Wavelength 850 nm (VCSEL) / 1300 nm (older LEDs) 1310 nm, 1550 nm, 1625 nm
Light Source LED (OM1/OM2), VCSEL (OM3/OM4/OM5) DFB Laser, EML Laser
Distance (Range) OM1: 300 m @ 850 nm, OM2: 550 m @ 850 nm, OM3: 300 m @ 10G, OM4: 400 m @ 10G, OM5: Optimized for SWDM OS1: Up to 10 km (Indoor), OS2: Up to 200 km (with amplification)
@t11z
t11z / wordpress-mysql-traefik.yml
Last active May 23, 2024 11:44
Example Kubernetes manifest that creates deployments for Wordpress, MySQL and Traefik with Let's Encrypt certificates. Based on https://gist.github.com/t11z/57bb925e80d2a88303c431a43acbd1bf
apiVersion: apps/v1
kind: Deployment
metadata:
name: wordpress
spec:
replicas: 1
selector:
matchLabels:
app: wordpress
template:
@t11z
t11z / docker-compose.yml
Created May 23, 2024 11:39
Example Docker Compose file that installs Wordpress with MySQL database behind a Traefik with Let's Encrypt certificate
version: '3.1'
services:
wordpress:
image: wordpress
container_name: wordpress
restart: always
labels:
- "traefik.enable=true"
@t11z
t11z / rce.php
Last active December 15, 2022 16:07
Testfile for PHP Remote Code Execution
<?php
exec('/bin/hostname');
?>
@t11z
t11z / docker_k8s_cheatsheet.md
Last active June 2, 2022 12:34
Docker & Kubernetes cheat sheet
Create Deployment from running Docker container
docker run -d --restart=always --name juice-shop -p 80:3000 bkimminich/juice-shop

kubectl get deploy juice-shop -o yaml \ 
  | yq eval 'del(.metadata.resourceVersion, .metadata.uid, .metadata.annotations, .metadata.creationTimestamp, .metadata.selfLink, .metadata.managedFields, .status)' - > juice-shop.yaml

Also look here:

https://kubernetes.io/de/docs/reference/kubectl/cheatsheet/

@t11z
t11z / install_ansible.sh
Last active October 17, 2021 06:20
Install Ansible in Python virtual environment (VENV)
#!/bin/bash
case $(awk -F= '/^ID/{print $2}' /etc/os-release) in
debian|ubuntu)
sudo apt-get -y install python3-venv
;;
rhel|centos)
sudo yum -y install python3-venv
;;
@t11z
t11z / install_docker.sh
Created May 30, 2021 11:06
Install Docker Community Edition on Debian 10+
#!/bin/bash
apt-get -y remove docker docker-engine docker.io containerd runc
apt-get -y update
apt-get -y install apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get -y update
apt-get -y install docker-ce docker-ce-cli containerd.io
@t11z
t11z / install_prisma_cloud_compute_edition.sh
Last active August 4, 2023 08:38
Install Palo Alto Networks Prisma Cloud Compute Edition version 20.04 on Linux VM
#!/bin/bash
access_token=$1
# identify distro and install docker
#
if [[ $(cat /etc/os-release) == *"openSUSE"* ]]; then
# openSUSE
sudo zypper install -y docker
elif [[ $(lsb_release -a) == *"Ubuntu"* || $(lsb_release -a) == *"Debian"* ]]; then
@t11z
t11z / .bashrc
Last active July 21, 2020 12:34
t11z's favourite bash settings/aliases
# bash prompt
export PS1="\u@\h:\w\e[0;32m>\e[m "
# create a 24 character alphanumeric pre-shared-key based on random data
# tested on macOS & OpenSUSE Linux
alias psk='cat /dev/urandom | env LC_CTYPE=C tr -dc a-zA-Z0-9 | head -c 24; echo'