Skip to content

Instantly share code, notes, and snippets.

View theking2's full-sized avatar
🎯
contemplating the odds

Johannes Kingma theking2

🎯
contemplating the odds
View GitHub Profile
@theking2
theking2 / docker_logs
Created May 3, 2026 06:41
Docker Log sizes
#!/usr/bin/env python3
"""
Docker Container Log Size Calculator
Lists all Docker containers with their log sizes and total log usage.
"""
import subprocess
import json
import sys
from typing import Dict, List, Tuple
@theking2
theking2 / style-test.php
Last active April 7, 2026 11:22
Elementor global style revealer
<?php
/**
* Elementor Global Style Test Page
*
* Drop this file into your WordPress root (or theme folder).
* It bootstraps WordPress just enough to get the stylesheet URL
* and all Elementor global CSS variables — no manual copy-paste needed.
*
* Usage:
* - Place in WP root: https://yoursite.com/elementor-style-test.php
@theking2
theking2 / excerpt-setup.md
Last active March 6, 2026 16:41
Install Win11 on virtio scsi with kmu

Virtio DISK 1

<disk type="file" device="disk">
  <driver name="qemu" type="qcow2" cache="unsafe" discard="unmap"/>
  <source file="/var/lib/libvirt/images/win11.qcow2" index="3"/>
  <backingStore/>
  <target dev="vda" bus="virtio"/>
  <alias name="virtio-disk0"/>
  <address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/>
@theking2
theking2 / README.md
Last active February 25, 2026 09:45
copy path

Copy path

  1. upload the path.php to a location you want the path of
  2. run the https://<host>/path.php file, and click Copy path
  3. paste the path where you really need it.
#! /bin/bash
cp /etc/hosts.base ~/hosts
curl https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts >> ~/hosts
sudo mv ~/hosts /etc/hosts
sudo systemctl reload dnsmasq
@theking2
theking2 / nextcloud_report
Last active May 24, 2025 10:12
nextcloud support request
#!/bin/bash
reverse_proxy_version=$(docker container exec nginx-proxy nginx -v 2>&1 | head -n 1)
echo "
Some or all of the below information will be requested if it isn't supplied; for fastest response please provide as much as you can. :heart:
* Nextcloud Server version:
- \`$(docker container exec nextcloud php /var/www/html/occ --version)\`
ssh -t <servername> "sudo docker container logs <containername> --follow"
ssh -t srv-nas-pi "sudo docker container logs nextcloud --follow"
@theking2
theking2 / polishnotation.php
Last active July 9, 2025 13:16
Polish notation
<?php
/**
* Polish notation
* @param $expression - Space seperated operators and param indices
* @param $param - two or more params for the calculation
*/
function pn(string $expression, mixed ...$param) {
$operators = "+-*/%"; $delimiter = " ";
$expression = explode($delimiter, $expression);
@theking2
theking2 / import-dump.cmd
Created February 5, 2025 15:07
Import Mariadb Dump
@ECHO OFF
@ECHO Expanding
@tar -xf %1
@ECHO Importing
@"C:\wamp\bin\mariadb\mariadb10.6.18\bin\mysql.exe" --user=username --password=password database < %~n1
@ECHO Cleaning
@del %~n1
@theking2
theking2 / config.php
Last active March 5, 2026 06:01
docker-compose.yaml for nginx-proxy-manager with nextcloud
<?php
$CONFIG = [
'htaccess.RewriteBase' => '/',
'memcache.local' => '\\OC\\Memcache\\APCu',
'apps_paths' =>
[
[
'path' => '/var/www/html/apps',
'url' => '/apps',
'writable' => false,