Skip to content

Instantly share code, notes, and snippets.

View ahbanavi's full-sized avatar
🎯
Focusing

Amir ahbanavi

🎯
Focusing
View GitHub Profile
@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 / 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 / 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 / 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 / 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)) {