Skip to content

Instantly share code, notes, and snippets.

View DejfCold's full-sized avatar

DejfCold DejfCold

View GitHub Profile
@DejfCold
DejfCold / nvidia-suspend-then-hibernate-fix.sh
Last active July 22, 2025 21:20
Fixes nvidia not switching to previously active VT after waking up from hibernation from suspend-then-hibernate. The original `/usr/lib/systemd/system-sleep/nvidia` claims it should be handled by systemd nvidia-resume.service which in my case, never runs.
#!/usr/bin/sh
# Fixes nvidia not switching to previously active VT after waking up from hibernation from suspend-then-hibernate.
# Original /usr/lib/systemd/system-sleep/nvidia claims it should be handled by systemd nvidia-resume.service which in my case, never runs.
#
# Requires already setup hibernation and suspend functionality using nvidia official drivers.
# Tested with Fedora 42, nvidia driver 575.64.03 (from RPM Fusion - https://rpmfusion.org/Howto/NVIDIA) and nvidia T500 GPU
# Place this script in /usr/lib/systemd/system-sleep/ and chmod +x
#
# The event order of failed hibernation isn't specified
@DejfCold
DejfCold / instructions.md
Last active August 16, 2023 22:19
[DRAFT] Production k8s setup for dummies (like me)

Production k8s setup for dummies (like me)

For years now, I'm searching for a tutorial on how to deploy a production ready k8s cluster. I found some, but pretty much all of them have issues. Let's look at what I've found so far:

Production ready cluster ...

  1. on one node. That's great, but then I can use just docker compose instead and save myself all the hastle with k8s.
  2. with disabled firewall. I guess that's fine if you have your own DC/lab with a separate firewall. Though I'd still like to have firewall running on every machine in the network anyway.
  3. that just doesn't work. Maybe I'm stupid, but the most common issue is, that pods on 2 different nodes can't communicate with each other.

Let's summarize what I want:

@DejfCold
DejfCold / web-archive-mzcr-dezinformatori.py
Created December 14, 2021 03:50
Web Archive a "Dezinformátoři" na koronavirus.mzcr.cz
import requests
# https://twitter.com/maestrosill/status/1470496141884235793
r = requests.get('http://web.archive.org/cdx/search/cdx?url=koronavirus.mzcr.cz/&fl=timestamp&collapse=digest')
timestamps = r.text.splitlines()
lenght = len(timestamps)
for idx, timestamp in enumerate(timestamps):
print(f'{idx + 1} / {lenght}')
url = f'http://web.archive.org/web/{timestamp}/https://koronavirus.mzcr.cz/'
@DejfCold
DejfCold / nomad.hcl
Last active July 7, 2025 15:35
Nomad + Vault + Consul + Rabbitmq + FreeIPA
job "rabbitmq" {
datacenters = ["dc1"]
type = "service"
group "rabbitmq" {
count = 2
constraint {
distinct_hosts = true
}
network {
mode = "host"
@DejfCold
DejfCold / README.md
Created May 8, 2021 02:38
OCMOD pretty URL

OCMOD pretty URL

Generates nice URLs from information, category, manufacturer and product pages.

There is no need to setup anything in OpenCart other than the install process.

URLs are generated from names (including spaces) and handle duplicate categories (it checks parent ID of each category).

Products have the following format: {product_id}-{model}