Skip to content

Instantly share code, notes, and snippets.

View ahbanavi's full-sized avatar
🎯
Focusing

Amir ahbanavi

🎯
Focusing
View GitHub Profile
@ahbanavi
ahbanavi / script.js
Created March 17, 2025 06:43
find duplicated name in a web page
const findDuplicateNames = () => {
// Get all form elements excluding radio buttons
const elements = document.querySelectorAll('input:not([type="radio"]), textarea, select');
const nameMap = new Map();
elements.forEach(element => {
const name = element.getAttribute('name');
if (name) {
if (!nameMap.has(name)) {
@ahbanavi
ahbanavi / n8n-docker-compose.yml
Last active March 3, 2025 07:15
Docker Compose configuration for setting up n8n
# https://gist.github.com/ahbanavi/308b27b5538559352dac960d48772cde
services:
n8n:
image: docker.n8n.io/n8nio/n8n
container_name: n8n
restart: always
environment:
N8N_SECURE_COOKIE: false # If you also want to use it with localhost
WEBHOOK_URL: https://n8n.example.com # The domain configured in Cloudflare Zero Trust
@ahbanavi
ahbanavi / nyaa_rss_check.sh
Last active February 18, 2025 19:23
Nyaa.si RSS Feed Monitor with Telegram Notifications
#!/bin/bash
# RSS Feed Monitor for Nyaa.si
# ==========================
# This script monitors nyaa.si RSS feed for new items matching a keyword and sends
# notifications via Telegram.
# By default, this script only checks for english-translated anime items.
#
# Requirements:
# - curl
@ahbanavi
ahbanavi / script.sh
Last active December 9, 2024 20:27
Dcoker Bind NIC (Network Interface)
# Interface to bind in this example
# ID: wlan0, IP: 192.168.10.183, Gateway: 192.168.10.1
docker network create -d bridge --subnet=172.18.0.0/16 --gateway=172.18.0.1 -o com.docker.network.bridge.enable_ip_masquerade=false -o com.docker.network.bridge.name=docker_binded docker_binded
echo '1 docker_binded' >> /etc/iproute2/rt_tables
ip rule add from 172.18.0.0/16 tab docker_binded
ip route add 172.18.0.0/16 dev wlan0 tab docker_binded
@ahbanavi
ahbanavi / Code.gs
Last active August 20, 2024 10:50
This script updates Google Slides footers to display slide numbers and non-skipped slide counts in Persian numerals.
function updateSlideFootersWithNotSkippedCount() {
// Get the active presentation
var presentation = SlidesApp.getActivePresentation();
// Get all the slides in the presentation
var slides = presentation.getSlides();
// Initialize a counter for not skipped slides
var notSkippedCount = 0;
@ahbanavi
ahbanavi / update_dat_files.sh
Created July 5, 2024 10:51
update v2ray geofiles on openwrt passwall
#!/bin/ash
ASSETS_DIR="/usr/share/v2ray"
GEOIP_FILE_NAME="geoip.dat"
GEOSITE_FILE_NAME="geosite.dat"
RELEASE_BASE_URL="https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/"
update_file() {
url="$RELEASE_BASE_URL$1"
current_file="$ASSETS_DIR/$1"
@ahbanavi
ahbanavi / openwrt-setup.md
Last active March 8, 2025 16:56
My OpenWrt Initial Setup (Passwall2 + extroot + vnstat)

My OpenWrt Initial Setup

My Router Info

  • Model: Linksys EA8100
  • Memory: 256MB
  • Storage: Using 16GB thumb drive as extroot
  • OpenWrt Version: OpenWrt 23.05.3 r23809-234f1a2efa / LuCI openwrt-23.05 branch git-24.073.29889-cd7e519

Extroot

@ahbanavi
ahbanavi / v2ray_ip_replace.sh
Last active January 16, 2024 15:29
This Bash script replaces hostnames with IP addresses in V2Ray and VLESS server configurations (from subscription url) by resolving each domain to its IP.
#!/bin/bash
# read url from args
url=$1
# If no URL is provided, exit with usage
if [[ -z "$url" ]]; then
echo "Usage: $0 <url>"
exit 1
fi
@ahbanavi
ahbanavi / switch_interface_ssh.sh
Last active July 3, 2024 18:16
swich / watch wan interfaces on router to swich between them based on cron or usage
#!/bin/bash
interface=$1
# Check if the interface is valid and set the other interface
if [[ $interface == "wan" ]]; then
other_interface="wanb"
elif [[ $interface == "wanb" ]]; then
other_interface="wan"
else
@ahbanavi
ahbanavi / hevc.bat
Created December 12, 2023 22:17
ffmpeg stuff :) just drag and drop videos to the `.bat` file
@echo off
for %%A in (%*) do (
ffmpeg -i "%%A" -vcodec hevc_nvenc "%%~nA.x265%%~xA"
)
pause