Skip to content

Instantly share code, notes, and snippets.

@Nenzyz
Nenzyz / 01_longhorn_bestpractices.md
Created August 4, 2025 20:20 — forked from ifeulner/01_longhorn_bestpractices.md
Longhorn hcloud best practices

Longhorn best practices

The following settings are provided as an example how longhorn should be configured in a production cluster, especially if it is deployed on Hetzner Cloud infrastructure.

Hetzner server nodes provide local storage and allow up to five attached volumes (with a size of up to 10TiB each) Local storage is provided by NVMe storage and therefore is much faster than the attached volumes, but limited in size (max 300GiB usable).

It is assumed that the cluster creation is already done, e.g. via terraform scripts provided by the great kube-hetzner project.

Initial configuration

fallocate -l 8G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
mount -a
@Nenzyz
Nenzyz / install_AdGuardHome.sh
Created September 6, 2024 07:49 — forked from stu43005/install_AdGuardHome.sh
install AdGuard Home in Synology RT1900ac
mkdir /opt
cd /opt
wget https://github.com/AdguardTeam/AdGuardHome/releases/download/latest/AdGuardHome_linux_armv7.tar.gz
tar -xzvf AdGuardHome_linux_armv7.tar.gz
# grep -rn '/etc/' -e 'dnsmasq'
# netstat -lnp | grep 'dnsmasq'
echo "port=0" >> /etc/dhcpd/dhcpd-port-port.conf
echo 'enable="yes"' > /etc/dhcpd/dhcpd-port-port.info
echo "port=0" >> /etc/dhcpd/dhcpd.conf
# Convert pem to der
openssl x509 -outform der -in certificate.pem -out certificate.der
# Import
keytool -importcert -trustcacerts -file ~/Downloads/mitmproxy-ca-cert.der -alias mitmproxy -storepass changeit -keystore /Users/<USER>/.asdf/installs/java/liberica-17.0.6+10/lib/security/cacerts
# asdf keystore location on macOS
/Users/<USER>/.asdf/installs/java/<JAVA_INSTALLATION>/lib/security/cacerts
@Nenzyz
Nenzyz / postgres_queries_and_commands.sql
Last active May 12, 2025 14:52 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show db sizes
SELECT datname as db_name, pg_size_pretty(pg_database_size(datname)) as db_usage FROM pg_database;
-- show and terminate
SELECT * --, pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE usename='postgres' AND datname='dev-dc-server';
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
@Nenzyz
Nenzyz / cryptography_ecdsa.py
Created August 7, 2023 09:10 — forked from gabrielfalcao/cryptography_ecdsa.py
Ed25519 signing in python
from cryptography.hazmat.primitives.asymmetric.ed25519 import (
Ed25519PrivateKey,
Ed25519PublicKey,
)
from cryptography.hazmat.primitives import serialization
private_key = Ed25519PrivateKey.generate()
public_key = private_key.public_key()
@Nenzyz
Nenzyz / zfsbench
Created July 30, 2023 13:58 — forked from mergwyn/zfsbench
ZFS benchmarking using fio
#!/usr/bin/env bash
set -o errexit
echo $(date):Random read
fio --filename=test --sync=1 --rw=randread --bs=4k --numjobs=1 \
--iodepth=4 --group_reporting --name=test --filesize=10G --runtime=300 && rm test
echo $(date):Random write
fio --filename=test --sync=1 --rw=randwrite --bs=4k --numjobs=1 \
@Nenzyz
Nenzyz / SSLPoke.java
Created January 27, 2023 16:29 — forked from 4ndrej/SSLPoke.java
Test of java SSL / keystore / cert setup. Check the comment #1 for howto.
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {