Skip to content

Instantly share code, notes, and snippets.

View HirbodBehnam's full-sized avatar

Hirbod Behnam HirbodBehnam

View GitHub Profile
@HirbodBehnam
HirbodBehnam / matrix-ntfy.md
Created May 11, 2026 13:38
A short guide on how to setup local push notification service for a self-hosted matrix server.

Matrix Push Notification With ntfy

A short guide to teach you how to setup Matrix push notification service using ntfy in air gapped environment. This guide is divided by the programs you should run and configure. There is a assumption that you have already setup an synapse server.

ntfy

To setup ntfy, you need to create a configuration file named /etc/ntfy/server.yml and place this inside it:

base-url: "https://ntfy.example.com"
// A cloudflare worker that just proxies data from somewhere to you
// Credits to https://github.com/TheGreatAzizi/GitHub-High-Speed-Mirror
export default {
async fetch(request, env, ctx) {
// Parse the URL
const url = new URL(request.url);
const params = new URLSearchParams(url.search);
if (!params.has("url")) return new Response("Invalid URL", { status: 400 });
const target = params.get("url");
@HirbodBehnam
HirbodBehnam / ff-downloader.sh
Created July 30, 2025 09:21
Download links from fuckingfast.co
#!/bin/bash
while read -r link; do
real_link=$(curl "$link" | grep "https://fuckingfast.co/dl/" | grep -oP '(?<=")[^"]*(?=")')
echo "Downloading $link from $real_link"
aria2c "$real_link"
done < "$1"
@HirbodBehnam
HirbodBehnam / port-puncher.go
Created July 5, 2025 06:16
Ask the public address of a port from STUN server
package main
import (
"fmt"
"net"
"os"
"time"
"github.com/pion/stun"
)
@HirbodBehnam
HirbodBehnam / daneshmand-activator.py
Created April 8, 2025 08:00
Activate Daneshmand software course series with your legit serial key
def find_activation_code(param1, param2):
# Check if all parameters have the expected length
if len(param1) != 16 or len(param2) != 16:
return False
loc4 = ""
loc7 = "0000"
# Process in chunks of 4 characters
for loc8 in range(0, 16, 4):
@HirbodBehnam
HirbodBehnam / debian-xfce.Dockerfile
Last active August 9, 2024 17:14
Run xfce inside a docker container and VNC to it. Based on https://github.com/iphoneintosh/ubuntu-docker
# Based on https://github.com/iphoneintosh/ubuntu-docker
FROM debian:12
# prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# update dependencies
RUN apt update
RUN apt upgrade -y
@HirbodBehnam
HirbodBehnam / dedup.ps1
Created July 28, 2024 08:28
Deduplicate files with symbolic links
# Use https://github.com/sreedevk/deduplicator then use
# jq 'map(. + {key: (.hash + (.size | tostring))}) | group_by(.key) | map([.[] | .path[22:]])' dup.json
# to get the changed.json file.
# The script must be ran as admin.
$a = cat changed.json | ConvertFrom-Json
foreach ($duplicate_files in $a)
{
foreach ($file in ($duplicate_files | Select-Object -Skip 1)) {
Write-Host "Deleting", $file
Remove-Item $file
@HirbodBehnam
HirbodBehnam / media-archiver.sh
Created July 22, 2024 03:55
Archive media to other formats for better size
#!/bin/bash
DESTINATION="$1/"
if [[ "$DESTINATION" == "" ]]; then
echo "Please provide destination in arguments."
exit 1
fi
echo "Compressing files from $PWD to $DESTINATION"
true > errors.txt
# Iterate in folders
find . -type d | while read -r directory; do
@HirbodBehnam
HirbodBehnam / ipv6-rotate.sh
Created May 17, 2024 08:20
Rotate your server's IPv6
#!/bin/bash
# Put it in crontab: */5 * * * * /bin/bash /root/scripts/ipv6-rotate.sh
# Get the next IPv6
CURRENT_IP=$(cat ~/.config/rotate-ip)
NEXT_IP=$(((CURRENT_IP+1)%65534))
echo "$NEXT_IP" > ~/.config/rotate-ip
CURRENT_IP=$(printf "%x" "$CURRENT_IP")
NEXT_IP=$(printf "%x" "$NEXT_IP")
CURRENT_IP="x:x:x::$CURRENT_IP"
NEXT_IP="x:x:x::$NEXT_IP"
@HirbodBehnam
HirbodBehnam / cargo-config.toml
Last active September 13, 2025 13:44
The Cargo config file I use for cross compiling
# Place this file as $CARGO_HOME/config.toml
# Run this command before compiling anything to install compilers
# apt install gcc-x86-64-linux-gnu gcc-aarch64-linux-gnu gcc-mingw-w64 pkg-config-aarch64-linux-gnu
# You might also add packages like this:
# dpkg --add-architecture arm64
# apt update
# apt install libssl-dev:arm64 pkg-config pkg-config:arm64
# export PKG_CONFIG=aarch64-linux-gnu-pkg-config
[target.x86_64-unknown-linux-musl]