Skip to content

Instantly share code, notes, and snippets.

View ahbanavi's full-sized avatar
🎯
Focusing

Amir ahbanavi

🎯
Focusing
View GitHub Profile
@ahbanavi
ahbanavi / README.md
Created August 7, 2026 14:31
Full voice control of an LG C5 (webOS 25) from Home Assistant + Google Assistant, without LG ThinQ — IR turn-on because Wake-on-LAN can't work, screen-off, app launching, repurposed remote keys

Full voice control of an LG C5 (webOS 25) from Home Assistant + Google Assistant — without LG ThinQ

Everything here runs over the LAN: no LG cloud, no Nabu Casa, no rooting the TV, nothing sideloaded onto it. Home Assistant talks to the set with the built-in webostv integration, and Google only ever sees HA's own fulfillment.

Written up because ThinQ was a dead end for me and most of the individual pieces below are either undocumented, wrong in the obvious place, or only findable by reading the integration source.

Tested on an OLED65C56LA, firmware 33.31.68, HA 2026.7.4.

@ahbanavi
ahbanavi / README.md
Created August 6, 2026 14:17
Jellyfin on LG webOS: every clock off by your UTC offset — webOS's WebAppManager engine resolves Intl's default time zone to Etc/Unknown (= UTC) while Date is correct. Full diagnosis + a self-gating JS fix.

Jellyfin on LG webOS: every clock is off by exactly your UTC offset

TL;DR — webOS's WebAppManager engine resolves the default Intl time zone to Etc/Unknown, which ICU formats as UTC. Date is perfectly correct; only Intl is broken. jellyfin-web renders every clock through Intl, so they all shift together by your UTC offset. Nothing about your TV, server, or container time zone is misconfigured. Fix: pin the zone from JavaScript (webos-intl-timezone-fix.js).


Symptoms

In the Jellyfin app on an LG Smart TV, every rendered time is behind (or ahead) by exactly your UTC offset:

@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 June 29, 2026 17:36
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 April 29, 2026 09:06
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