Skip to content

Instantly share code, notes, and snippets.

@Lu5ck
Lu5ck / check_mem_leak.sh
Last active January 24, 2024 20:07
Palworld - Dedicated Linux Server Scripts
#Script to check for available memory
#If available memory is below certain amount, it will initiate shutdown
#The shutdown is done via rcon https://github.com/gorcon/rcon-cli
#You can get this script to be execute in crontab
#!/bin/bash
lock_file="/home/Palworld/Palworld/check_mem_leak.lock"
rcon_yaml="/home/Palworld/Palworld/rcon.yaml"
rcon="/home/Palworld/Palworld/rcon"
@Lu5ck
Lu5ck / pbr.user.azure
Last active April 24, 2025 08:36
OpenWRT PBR Azure by Regions
#!/bin/sh
# shellcheck disable=SC2015,SC3003,SC3060
AZURE_URL="https://www.microsoft.com/en-us/download/details.aspx?id=56519"
AZURE_JSON_FILE="/var/tmp/pbr_azure_ip_ranges.gz"
AZURE_REGIONS="southeastasia southindia"
AZURE_ADD_EMPTY_REGION="n"
TARGET_TABLE="inet fw4"
TARGET_INTERFACE="wan"
AZURE_IPv4="/var/tmp/pbr_azure_ipv4.txt"
@Lu5ck
Lu5ck / pbr.user.aws
Last active April 24, 2025 08:35
OpenWRT PBR AWS by Regions
#!/bin/sh
# shellcheck disable=SC2015,SC3003,SC3060
AWS_URL="https://ip-ranges.amazonaws.com/ip-ranges.json"
AWS_JSON_FILE="/var/tmp/pbr_aws_ip_ranges.gz"
AWS_REGIONS="ap-southeast-3 ap-southeast-5 ap-southeast-1 GLOBAL"
TARGET_TABLE="inet fw4"
TARGET_INTERFACE="wan"
AWS_IPv4="/var/tmp/pbr_aws_ipv4.txt"
AWS_IPv6="/var/tmp/pbr_aws_ipv6.txt"
@Lu5ck
Lu5ck / pbr.user.fastly
Last active April 24, 2025 08:33
OpenWRT PBR Fastly
#!/bin/sh
# shellcheck disable=SC2015,SC3003,SC3060
FASTLY_URL="https://api.fastly.com/public-ip-list"
FASTLY_JSON_FILE="/var/tmp/pbr_fastly_ip_ranges.gz"
TARGET_TABLE="inet fw4"
TARGET_INTERFACE="wan"
cleanup()
{
rm -f "$FASTLY_JSON_FILE"
@Lu5ck
Lu5ck / pbr.user.asn
Created April 25, 2025 16:10
OpenWRT PBR by AS number
#!/bin/sh
# shellcheck disable=SC2015,SC3003,SC3060
# ASN example
# Replace "ASN_" with a unique word to minimize conflicts with other asn based scripts
ASN_URL="https://stat.ripe.net/data/announced-prefixes/data.json?resource=AS138341"
ASN_JSON_FILE="/var/tmp/pbr_asn_ip_ranges.gz"
TARGET_TABLE="inet fw4"
TARGET_INTERFACE="wan"
@Lu5ck
Lu5ck / pbr.user.geoip
Last active April 26, 2025 16:59
OpenWRT PBR by GeoIP
#!/bin/sh
# shellcheck disable=SC2015,SC3003,SC3060
# See https://www.iwik.org/ipcountry/ for list
GEO_PREFIX="SG"
GEO_URL="https://www.iwik.org/ipcountry"
TARGET_TABLE="inet fw4"
TARGET_INTERFACE="wan"
GEO_IPv4="/var/tmp/pbr_geo_ipv4.txt"