Skip to content

Instantly share code, notes, and snippets.

View bestrocker221's full-sized avatar
🎯
Focusing

Carlo Alberto bestrocker221

🎯
Focusing
View GitHub Profile
@bestrocker221
bestrocker221 / traefik.yml
Created April 14, 2024 12:28
Example for a Traefik.yml configuration
api:
insecure: true # Enable the Traefik dashboard (for development)
providers:
docker:
exposedByDefault: false # Only expose containers with labels
entryPoints:
web:
address: ":80"
@bestrocker221
bestrocker221 / docker-compose.yml
Last active April 15, 2024 17:00
Example for Traefik + internal docker networks
version: '3.8'
services:
traefik:
image: traefik
container_name: traefik
security_opt:
- no-new-privileges:true
ports:
- "80:80" # Expose port 80 for incoming HTTP traffic
- "8080:8080" # Expose 8080 for dashboard (dev only)
@bestrocker221
bestrocker221 / dynamic_record_update_cloudflare_api.sh
Created July 28, 2023 16:43
Dynamic DNS record update through Cloudflare APIs
#!/bin/bash
ZONE_ID=<YOUR_ZONE_ID>
A_record=<domain/subdomain>
A_record_id=<RECORD ID>
CF_BEARER=<YOUR_CF_DNS_TOKEN>
LOG_FILE="./ip_log.txt"
DNS_UPDATE_LOG_FILE="./update_dns_history.log"
@bestrocker221
bestrocker221 / install_docker_compose.sh
Created April 15, 2023 21:44
Install Docker and Docker Compose (deb + docker group)
#!/bin/bash
sudo apt -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker-archive-keyring.gpg
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io -y
sudo systemctl enable --now docker

Keybase proof

I hereby claim:

  • I am bestrocker221 on github.
  • I am bestrocker (https://keybase.io/bestrocker) on keybase.
  • I have a public key whose fingerprint is B2D8 B595 F51F 7327 85F3 0826 DDB2 37B4 93D1 533B

To claim this, I am signing this object:

@bestrocker221
bestrocker221 / freeradius_password_hash_sha256_salt.py
Created March 17, 2019 18:01
SSHA2-256 FreeRadius password hashing
from hashlib import sha256
from base64 import b64encode, b64decode
# salt size = 12
SALT_SIZE = 12
def hashPassword(password, salt):
ctx = sha256(password)
ctx.update(salt)
##############################################
# Sample client-side OpenVPN 2.0 config file #
# for connecting to multi-client server. #
# #
# This configuration can be used by multiple #
# clients, however each client should have #
# its own cert and key files. #
# #
# On Windows, you might want to rename this #
# file so it has a .ovpn extension #
@bestrocker221
bestrocker221 / get_email.sh
Last active June 5, 2018 11:38
Get email addresses from web page.
#!/bin/bash
#$1 is the URL
curl -s $1 | grep -Po 'mailto:[[:print:]]*@[a-zA-Z0-9]*\.[a-z]{2,3}' | sed -e 's/mailto://g' | cut -f1 -d"\""
@bestrocker221
bestrocker221 / gen_cert_wifi_server.sh
Created April 28, 2018 18:11
Generate rsa certificate for esp8266 wifi Secure Server
#!/bin/bash
# This script generates a self-signed certificate for use by the ESP8266
# Replace your-name-here with somethine appropriate before running and use
# the generated .H files in your code as follows:
#
# static const uint8_t rsakey[] ICACHE_RODATA_ATTR = {
# #include "key.h"
# };
#
@bestrocker221
bestrocker221 / gen_rsa_cert.sh
Created April 28, 2018 18:09
generate self-signed rsa certificate (4096)
#!/bin/bash
if [ $# -ne 1 ]; then
echo "usage: <hostname>"
exit 1
fi
CN=$1
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 -out ${CN}.key
openssl req -new -sha256 -key ${CN}.key -out ${CN}.csr \