Skip to content

Instantly share code, notes, and snippets.

# RAM Disk SSH Access Configuration
ram_disk:
enabled: true
mount_point: "/mnt/ramdisk"
size: "100M" # Adjust as necessary
permissions:
- "noexec" # Prevent execution of binaries
- "nosuid" # Disallow setting user IDs on files
- "nodev" # Disallow device files
@fabriziosalmi
fabriziosalmi / generate_kickdrums.py
Created October 19, 2024 20:53
Generate 10000 Kick Drums
import numpy as np
import random
from scipy.io.wavfile import write
from scipy.signal import sawtooth, square
from pydub import AudioSegment, effects
import os
import hashlib
import librosa
from librosa.feature import mfcc
import concurrent.futures
@fabriziosalmi
fabriziosalmi / proxmox_configuration.md
Created November 29, 2024 17:29
proxmox configuration via yaml and python

Proxmox API Integration Guide

This repository demonstrates the use of the Proxmox API for programmatically managing Proxmox environments. By leveraging the API, you can efficiently handle Proxmox nodes, containers (LXC), and virtual machines (VMs) in a secure, scalable, and maintainable manner. This guide provides an example of automating tasks like LXC and VM creation using Python.


Features

  • Supports LXC and VM Management: Provision containers and VMs with detailed configurations.
  • Centralized Configuration: YAML-based configuration simplifies management of multiple hosts and nodes.
@fabriziosalmi
fabriziosalmi / caddywaf.go
Created January 3, 2025 10:54
4xx, 5xx error loop protection proposal
package caddywaf
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net"
"os"
"regexp"
@fabriziosalmi
fabriziosalmi / caddy-waf-suite.md
Last active January 9, 2025 22:30
Caddy WAF suite (caddy-mib, caddy-mlf, caddy-waf)

Caddy WAF suite

Caddyfile

{
	# Disable the admin API for security (optional)
	admin off

	# Disable automatic HTTPS for testing purposes

Okay, let's further extend the explanation on tuning options for the Caddy ML WAF (caddy-mlf), digging deeper into the nuances and advanced strategies.

Expanding on the Core Concepts:

To effectively tune caddy-mlf, it's crucial to understand the interplay between the different configuration options. They don't operate in isolation; adjusting one can impact the effectiveness of others. Think of it like a complex instrument where each knob and slider needs careful adjustment to produce the desired sound (in this case, accurate threat detection).

Deeper Dive into the Tuning Goals and Trade-offs:

We touched upon the trade-off between high security (minimizing false negatives) and high availability (minimizing false positives). Let's elaborate:

Guida Passo-Passo Dettagliata per la Creazione e Gestione di Multipli Moduli Caddy con Machine Learning per la Sicurezza Avanzata

Questa guida estesa e migliorata si concentra sulla gestione di più moduli Caddy in repository separati, simulando scenari di sviluppo collaborativo e integrando un flusso di lavoro strutturato con branching, testing e integrazione continua.

Fase 1: Preparazione Avanzata dell'Ambiente di Sviluppo e Struttura del Progetto (Aggiornata)

(Questa fase rimane sostanzialmente la stessa, ma con un focus sulla gestione di più repository)

  1. Installazione e Configurazione di Go: (Come prima)
  2. Clonazione dei Repository di Caddy e dei Tuoi Moduli:
@fabriziosalmi
fabriziosalmi / apache2cloudflareworker.py
Created January 14, 2025 11:13
Convert Apache rewrites to Cloudflare worker JS 301s
import re
import urllib.parse
def escape_regex(text):
"""Escapes special characters in regex."""
escaped_text = re.escape(text)
# Replace escaped spaces with \s
escaped_text = escaped_text.replace(r'\ ', r'\s')
#remove escaped \
escaped_text = escaped_text.replace(r'\\', r'\')
@fabriziosalmi
fabriziosalmi / example.yaml
Created March 24, 2025 07:21
Example infra yaml
proxmox_config:
username: "root"
password: "{{ proxmox_password }}"
network_gateway: "192.168.1.1"
network_cidr: "192.168.1.0/24"
os_template_debian: "local:vztmpl/debian-11-standard_11.6-1_amd64.tar.gz"
os_template_ubuntu: "local:vztmpl/ubuntu-22.04-standard_22.04-1_amd64.tar.gz"
api:
enabled: true
url: "https://{{ proxmox_hostname }}:8006/api2/json"