Skip to content

Instantly share code, notes, and snippets.

View krzysztofantczak's full-sized avatar

Krzysztof Antczak krzysztofantczak

View GitHub Profile
brennondenny.vsc-jetbrains-icons-enhanced
github.copilot
github.copilot-chat
isudox.vscode-jetbrains-keybindings
josemurilloc.aura-spirit-dracula
ms-vscode-remote.remote-wsl
ms-vscode.makefile-tools
pkief.material-icon-theme
rlivings39.fzf-quick-open
subframe7536.custom-ui-style
version: '2'
services:
pg-1:
container_name: pg-1
image: bitnami/postgresql-repmgr:14
restart: always
ports:
- 5432
volumes:
@krzysztofantczak
krzysztofantczak / gist:78555d66b2bb7583dbc1ee90fc4bf52a
Created November 12, 2024 12:20
HomeAssistant Supervised in docker
# Running Home Assistant in docker with one command
Originally produced by hass scripts:
```
docker container create --name hassio_supervisor --privileged --security-opt apparmor=hassio-supervisor \
-v /run/docker.sock:/run/docker.sock:rw \
-v /run/containerd/containerd.sock:/run/containerd/containerd.sock:rw \
-v /run/systemd-journal-gatewayd.sock:/run/systemd-journal-gatewayd.sock:rw \
-v /run/dbus:/run/dbus:ro \
## Used when you manage applications in the same cluster where Argo CD runs
createClusterRoles: true
## Custom resource configuration
crds:
install: true
keep: false
## Globally shared configuration
global:
KafkaExporter:
METRIC_PATH: 'kafka_metrics'
INTERVAL: 15
BACKOFF: 10
CONFIG:
brokers:
- '10.5.50.77:29193'
certificates:
ssl_ca_location: 'certs/ca-cert.pem' # Path to your CA certificate
| Parameter | Description | Default Value | Recommended Value |
|----------------------------------|-----------------------------------------------------------------------------|---------------|-------------------|
| `vm.swappiness` | Controls swap space usage. | 60 | 1 |
| `vm.dirty_background_ratio` | Percentage of system memory filled with dirty pages before flushing starts. | 10 | 5 |
| `vm.dirty_ratio` | Maximum percentage of dirty pages before forced flushing. | 20 | 60 |
| `vm.dirty_expire_centisecs` | Time after which dirty pages are eligible for write-out. | 3000 | 2000 |
| `vm.dirty_writeback_centisecs` | Time between periodic write-out of dirty pages. | 500
# Ensure IP forwarding is enabled
echo 1 > /proc/sys/net/ipv4/ip_forward
# Insert PREROUTING rule at the top of the chain
iptables -t nat -I PREROUTING 1 -p tcp -d A_IP --dport 8082 -j DNAT --to-destination B_IP:8082
# Insert POSTROUTING rule at the top of the chain
iptables -t nat -I POSTROUTING 1 -p tcp -d B_IP --dport 8082 -j MASQUERADE
# Ensure FORWARD chain allows traffic
{
"__inputs": [
{
"name": "DS_VICTORIA",
"label": "victoria",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
import re, json
import re
def jq(json_data, path, value=None, remove=False):
"""
Find JSON nodes matching the given path in jq-like syntax and update them with value.
Args:
import os
from prometheus_api_client import PrometheusConnect, PrometheusApiClientException
import csv
import datetime
import re
def sanitize_filename(filename):
# Replace characters not allowed in filenames with underscore
return re.sub(r'[^\w\.]', '_', filename)