Skip to content

Instantly share code, notes, and snippets.

@pedro0311
pedro0311 / piascript.sh
Created April 15, 2025 16:00
Script to set up PIA wireguard on FreshTomato
#!/usr/bin/env ash
# Script to set up PIA wireguard on FreshTomato
#
# Example setup:
#
# scp -O piascript.sh root@<ROUTER_IP>:
# pia_user='<REDACTED>' pia_pass='<REDACTED>' ./piascript.sh
#
# (borrowed from: https://github.com/rveznaver/pia-freshtomato)
@pedro0311
pedro0311 / wg.sh
Created April 10, 2025 21:42
This script will create the configuration for your wireguard site-to-site full mesh VPN
#!/bin/sh
# wg.sh ver 1.22 - rs232 - 03/23
# DO NOT EDIT THIS FILE!
# All the config is placed in the wg0.conf and you can produce this automatically via "wg.sh makeconf"
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/home/root
PID=$$
black="\033[0;40m"
grey="\033[0;5;238m"
green="\033[48;2;32m"
alias logw='logger -p WARN -t wg-sh[$PID]'
@pedro0311
pedro0311 / print-iptables-routing-dnsmasq.sh
Created January 28, 2025 22:32
Script useful for showing iptables/routing/dnsmasq settings
#!/bin/sh
echo
echo "######################## Filter (default) table: #######################"
iptables -t filter -vnL --line-numbers
echo
echo "######################## Nat table: ########################"
iptables -t nat -vnL --line-numbers
@pedro0311
pedro0311 / openssl-speed.sh
Created January 28, 2025 22:27
Script useful for testing openssl speed
#!/bin/sh
TESTS=1
CPUS=`cat /proc/cpuinfo | grep -c processor`
if [[ ${CPUS} -gt 1 ]]; then TESTS=`expr "${TESTS} ${CPUS}"`; fi
echo "aes-256-cbc:"
for THREADS in ${TESTS}
do
@pedro0311
pedro0311 / gen-openvpn-keys.sh
Last active January 28, 2025 22:28
Script to generate server/client(s) keys for openvpn
#!/bin/sh
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/home/root
#
# Script to generate server/client(s) keys for openvpn
# Use it on FreshTomato router
#
# Copyright (C) 2024 pedro
#
@pedro0311
pedro0311 / export_settings.sh
Created January 28, 2025 22:14
Script for exporting/backup selected FreshTomato settings
#!/bin/sh
# USE AT YOUR OWN RISK.
# THIS SCRIPT DOES NOT COME WITH ANY WARRANTY WHATSOEVER.
#
# Backs up selected nvram variables; import them just by running the resulting script.
# Should work equally well with both MIPS and ARM builds.
#
# Thanks to ryzhov_al for basic approach.
#