This document provides guidelines for maintaining high-quality Python code. These rules MUST be followed by all AI coding agents and contributors.
All code you write MUST be fully optimized.
"Fully optimized" includes:
Before continuing: This guide is currently outdated but I'm working on a new one with upgrading steps included. I'll link it here once it's finished :)
This is a guide that will show you how to setup Plex Media Server with Sonarr, Radarr, Jackett, Overseerr and qBitTorrent with Docker. It is written for Ubuntu 20.04 but should work on other Linux distributions as well (considering supported distributions by Docker). It is also written for people who have some experience with Linux and Docker. If you are new to Docker, I recommend you to read the Docker documentation, and if you are new to Linux, I recommend you to read the Ubuntu documentation.
Now, let's get started!
Please note: This guide was written without considering hardlinking for Sonarr/Radarr. If you want to use hardlinking refer to #Hardlinking
| # https://docs.databricks.com/en/dev-tools/auth/oauth-u2m.html#generate-oauth-pair | |
| # the auth is handled via azure cli | |
| # you need to issue `az login` and set the sub name|id where the ws is attached. | |
| import cmd | |
| import uuid, hashlib, base64 | |
| def generate_codes(): | |
| # Generate a UUID. |
| :global list "" | |
| :if ($bound=1) do={ | |
| :local alphabet "\00\01\02\03\04\05\06\07\08\09\0A\0B\0C\0D\0E\0F\10\11\12\13\14\15\16\17\18\19\1A\1B\1C\1D\1E\1F\ | |
| \20\21\22\23\24\25\26\27\28\29\2A\2B\2C\2D\2E\2F\30\31\32\33\34\35\36\37\38\39\3A\3B\3C\3D\3E\3F\ | |
| \40\41\42\43\44\45\46\47\48\49\4A\4B\4C\4D\4E\4F\50\51\52\53\54\55\56\57\58\59\5A\5B\5C\5D\5E\5F\ | |
| \60\61\62\63\64\65\66\67\68\69\6A\6B\6C\6D\6E\6F\70\71\72\73\74\75\76\77\78\79\7A\7B\7C\7D\7E\7F\ | |
| \80\81\82\83\84\85\86\87\88\89\8A\8B\8C\8D\8E\8F\90\91\92\93\94\95\96\97\98\99\9A\9B\9C\9D\9E\9F\ | |
| \A0\A1\A2\A3\A4\A5\A6\A7\A8\A9\AA\AB\AC\AD\AE\AF\B0\B1\B2\B3\B4\B5\B6\B7\B8\B9\BA\BB\BC\BD\BE\BF\ | |
| \C0\C1\C2\C3\C4\C5\C6\C7\C8\C9\CA\CB\CC\CD\CE\CF\D0\D1\D2\D3\D4\D5\D6\D7\D8\D9\DA\DB\DC\DD\DE\DF\ | |
| \E0\E1\E2\E3\E4\E5\E6\E7\E8\E9\EA\EB\EC\ED\EE\EF\F0\F1\F2\F3\F4\F5\F6\F7\F8\F9\FA\FB\FC\FD\FE\FF" |
This guide is for homelab admins who understand IPv4s well but find setting up IPv6 hard or annoying because things work differently. In some ways, managing an IPv6 network can be simpler than IPv4, one just needs to learn some new concepts and discard some old ones.
Let’s begin.
First of all, there are some concepts that one must unlearn from ipv4:
Concept 1
| # Import the needed credential and management objects from the libraries. | |
| from azure.identity import AzureCliCredential | |
| from azure.mgmt.resource import ResourceManagementClient | |
| from azure.mgmt.network import NetworkManagementClient | |
| from azure.mgmt.compute import ComputeManagementClient | |
| from azure.mgmt.compute.models import OrchestrationMode | |
| import os | |
| print(f"Provisioning a virtual machine scale set...some operations might take a minute or two.") |
| sudo qemu-system-aarch64 \ | |
| -kernel /Volumes/data/qemu/openwrt-23.05.05-armsr/openwrt-23.05.2-armsr-armv8-generic-initramfs-kernel.bin \ | |
| -drive file=/Volumes/data/qemu/openwrt-23.05.05-armsr/openwrt-23.05.2-armsr-armv8-generic-squashfs-rootfs.img.work,if=virtio,format=raw \ | |
| -append root=/dev/vda \ | |
| -cpu cortex-a57 -m 2048 -smp 2 -machine virt \ | |
| -nographic \ | |
| -device virtio-net-pci,netdev=net0 -netdev vmnet-host,id=net0,net-uuid=86d5e2de-594c-421e-be0d-8a3ac19dc207 \ | |
| -device virtio-net-pci,netdev=net1 -netdev vmnet-bridged,ifname=en0,id=net1 | |
I get asked pretty regularly what my opinion is on merge commits vs rebasing vs squashing. I've typed up this response so many times that I've decided to just put it in a gist so I can reference it whenever it comes up again.
I use merge, squash, rebase all situationally. I believe they all have their merits but their usage depends on the context. I think anyone who says any particular strategy is the right answer 100% of the time is wrong, but I think there is considerable acceptable leeway in when you use each. What follows is my personal and professional opinion:
Before continuing: This guide is currently outdated but I'm working on a new one with upgrading steps included. I'll link it here once it's finished :)
This is a guide that will show you how to setup Plex Media Server with Sonarr, Radarr, Jackett, Overseerr and qBitTorrent with Docker. It is written for Ubuntu 20.04 but should work on other Linux distributions as well (considering supported distributions by Docker). It is also written for people who have some experience with Linux and Docker. If you are new to Docker, I recommend you to read the Docker documentation, and if you are new to Linux, I recommend you to read the Ubuntu documentation.
Now, let's get started!
Please note: This guide was written without considering hardlinking for Sonarr/Radarr. If you want to use hardlinking refer to #Hardlinking
Normally to test Alertmanager templates you need to restart running Alertmanager and wait for alerts to arrive to Slack or email. To speed up this process parts of templates could be rendered locally using predefined alerts data without the need of the actual Alertmanager.
What you still need in this case is amtool which is a part of Alertmanager delivery which could be downloaded here https://github.com/prometheus/alertmanager/releases
Some examples of templates rendering:
# navigate to the templates dir