Skip to content

Instantly share code, notes, and snippets.

View aKamrani's full-sized avatar
:electron:
Creating

Amir Hossein Kamrani aKamrani

:electron:
Creating
View GitHub Profile
@aKamrani
aKamrani / stream.conf
Created July 29, 2025 08:12
OpenResty Dynamic SSL Certificate Selection Example
#------------------------------------------------------------------------------
# OpenResty Dynamic SSL Certificate Selection Example
#
# This conf snippet demonstrates how to dynamically serve different SSL
# certificates based on the SNI (Server Name Indication) hostname using Lua.
#
# Use this when you want to serve multiple domains with different SSL certs
# from a single OpenResty (nginx) instance, e.g. for XMPP, WebSocket, or HTTPS.
#
# This config is intended for use with the official OpenResty Docker image:
@aKamrani
aKamrani / LetsEncrpyt-SSL-Automatic-certbot
Last active July 26, 2025 08:23
LetsEncrpyt-SSL-Automatic-certbot
🙏 Descriptions goes on comments 🙏
@aKamrani
aKamrani / docker-aliases.sh
Last active July 21, 2025 08:50
Common Docker Aliases
############################################################################
# #
# ------- Useful Docker Aliases -------- #
# #
# # Installation : #
# copy/paste these lines into your .bashrc or .zshrc file or just #
# type the following in your current shell to try it out: #
# wget -O - https://gist.github.com//docker-aliases.sh | bash
# #
# # Usage: #
@aKamrani
aKamrani / Docker-Rootless-Security-Enhanced
Last active August 16, 2025 06:55
Docker Rootless (Security Enhanced Mode)
Docker Rootless Install (Security Enhanced Mode)
In this installation we have two security enhancements:
1- create two dedicated partitions for docker data and volume containers
2- use a indirect user to access docker container managements
[ Read Comments ]
@aKamrani
aKamrani / grafana-rocketchat.js
Last active February 13, 2025 10:47
Grafana alert RocketChat webhook script
// Rocketchat incoming grafana webhook script
// This script is for Rocketchat when defining an integration in Administartion / Workspace / Integration panel
// See the following links for some documentation:
// * Grafana outgoing format: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/incident/configure/integrations/configure-outgoing-webhooks/
// * Rocketchat incoming message format: https://developer.rocket.chat/reference/api/rest-api/endpoints/core-endpoints/chat-endpoints/postmessage#attachments-detail
class Script {
process_incoming_request({ request }) {
var alerts = request.content.alerts[0];
@aKamrani
aKamrani / 0-minio-docker-compose.yml
Last active June 28, 2025 11:27
Setup & Configure Minio
services:
minio:
container_name: minio
hostname: minio
image: quay.io/minio/minio
restart: unless-stopped
command: server --console-address ":9001" /data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
@aKamrani
aKamrani / squid.conf
Created December 26, 2024 10:27
Squid HTTPS proxy server
https_port 443 cert=/etc/letsencrypt/live/proxy-server.DOMAN.COM/fullchain.pem key=/etc/letsencrypt/live/proxy-server.DOMAN.COM/privkey.pem
acl allowed_network src 0.0.0.0/0
acl allowed_domain dstdomain .pep.shaparak.ir .op1.pgsb.ir .ident.me
#acl allowed_domain dstdomain .ident.me
# Authentication settings
auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwd
auth_param basic children 5
auth_param basic realm Squid Proxy Server
client - after mail logic on mailcow with pgp e2e encryption: https://autoize.ch/pgp-email-encryption-with-afterlogic-webmail-and-mailcow/
@aKamrani
aKamrani / Binance-Socket-Monitoring
Last active October 31, 2024 08:32
Binance Socket Monitoring | /etc/systemd/system/binance-monitor.service | /opt/binance-monitor/binance-monitor.py
sudo apt install python3-websocket
sudo systemctl daemon-reload
sudo systemctl start binance-monitor.service
sudo systemctl enable binance-monitor.service
sudo systemctl status binance-monitor.service
@aKamrani
aKamrani / mssql-backup-storage-powershell-minio-s3.ps1
Created October 31, 2024 07:02
Automatic Backup MSSQL Database to S3 Storage / Minio - Powershell Windows
$server = "127.0.0.1"
$database = "MMSQL_EXAMPLE_DATABSE"
$currentDate = Get-Date -Format "yyyy-MM-dd"
$backupFilePath = "F:\Backups\EXAMPLE-Backup-$currentDate.bak"
$logFilePath = "F:\Backup-Logs\EXAMPLE-Backup-Logs.txt"
$daysToKeep = 10
$mcPath = "F:\mc.exe"
$minioUrl = "https://storage.example.com"
$accessKey = "ACCESS_KEY"