Skip to content

Instantly share code, notes, and snippets.

View storm-legacy's full-sized avatar

storm-legacy storm-legacy

View GitHub Profile
@storm-legacy
storm-legacy / 0_usr_local_bin_knockd_script.sh
Last active October 3, 2025 10:13
KnockD configuration with extending of the opening.
#!/usr/bin/env bash
# Usage:
# knockd_script.sh start <IP>
# knockd_script.sh stop <IP>
# knockd_script.sh reset <IP>
# knockd_script.sh clean
PORT=2222
CHAIN="INPUT"
STATE_DIR="/var/lib/knockd/state"
@storm-legacy
storm-legacy / extract_mysql_slow_logs.py
Created September 13, 2023 06:25
Scripts extracting timings from slow logs (mysql | lsphp)
import re
pattern = r".*\s+Time:\s+(.*)\s+.*\s+.*Query_time:\s+(\d+\.\d+)\s+Lock_time:\s+(\d+\.\d+)\s+Rows_sent:\s+(\d+)\s+Rows_examined:\s+(\d+)\n((.|\n|)*)"
def parse_block(data):
matches = re.findall(pattern, data)
return matches
@storm-legacy
storm-legacy / docker-compose.Makefile
Last active April 14, 2025 11:44
Makefile for docker compose projects.
# Load default configuration
-include .env.example
DOCKER_CMD := docker
DOCKER_COMPOSE_FILE := compose.yml
DOCKER_COMPOSE_CMD := $(DOCKER_CMD) compose -f $(DOCKER_COMPOSE_FILE)
# Override with custom configuration
-include .env
# Configuration for collecting logs from each container as seperate file
# Additional docker-compose configuration:
# logging:
# driver: 'syslog'
# options:
# syslog-address: 'udp://127.0.0.1:5514'
# tag: '[custom PROGRAM name]'
@version: 3.35
@include "scl.conf"
@storm-legacy
storm-legacy / generate-psk.sh
Last active September 18, 2023 07:53
Zabbix Agent2 Goodies
#!/bin/bash
openssl rand -hex 128 > /etc/zabbix/agent.psk.key && \
chown root:zabbix /etc/zabbix/agent.psk.key && \
chmod 640 /etc/zabbix/agent.psk.key
@storm-legacy
storm-legacy / Makefile
Created June 23, 2023 11:40
Makefile for files backup
#* CONSTANTS
BAK_DIR = /var/backups/app
SRC_DIR = $(shell pwd)
#*
#* FILES BACKUP
#*
backup: rotate_files
tar --warning=no-file-changed -czf $(BAK_DIR)/$(shell date +"%s").application.tgz -C $(SRC_DIR) . >/dev/null 2>&1
@storm-legacy
storm-legacy / docker-compose.aria2.webui.yml
Created May 5, 2023 14:05
Aria2pro + AriaNg + traefik
version: '3'
volumes:
config: {}
networks:
inet:
name: inet
services:
@storm-legacy
storm-legacy / gpg.trust_key.sh
Last active May 5, 2023 14:06
Useful GPG commands
# Import key
gpg --import privatekey.gpg.asc
# List secert keys
gpg --list-secret-keys --keyid-format=long
# Edit trust level
gpg --edit-key <key-id>
gpg> trust
@storm-legacy
storm-legacy / docker-compose.yml
Last active February 28, 2023 16:56
MySQL + PMA + Traefik Template
version: '3'
networks:
traefik-proxy:
name: mysql-pma-traefik-proxy
ipam:
config:
- subnet: 10.225.0.0/24
gateway: 10.225.0.1
@storm-legacy
storm-legacy / .env
Last active February 3, 2023 18:50
GoLang Development Kit
POSTGRES_HOST=10.1.0.10
POSTGRES_PORT=5432
POSTGRES_USER=appuser
POSTGRES_PASSWORD=Password123!
POSTGRES_DB=app
TZ=Europe/Warsaw