Skip to content

Instantly share code, notes, and snippets.

View rudasn's full-sized avatar

Nicolas Rudas rudasn

View GitHub Profile
@tomasinouk
tomasinouk / snat_dnat_advantech.md
Last active April 3, 2025 19:03
examples of SNAT, DNAT with iptables for Advantech, Conel routers, with comments (probably will work on other routers where iptables can be manipulated, care needs to be taken on applying these commands after reboot).

Some examples of SNAT, DNAT with iptables with comments

mainly used in start-up script

How to test 'safely'

When we play with iptables aka firewall we might end up in situation, where we execute rule, which has unforseen impact - lock yourself out. Recovering from this situation is necessity.

How to:

  • Enable reboot via SMS.
  • Test all commands in shell first before putting them into Start-up script. This way the command will be wiped out, when unit is rebooted.

masquarade all outgoing packets to be WLAN0 IP

@cubarco
cubarco / simplehttpserver.go
Created December 3, 2015 03:03
This is a golang alternative to the SimpleHTTPServer of Python.
package main
import (
"flag"
"fmt"
"net/http"
)
func main() {
var port string
// per https://docs.npmjs.com/misc/scripts, npm exposes a bunch of variables to
// the environment prefixed with npm_config_*, npm_package_* and npm_lifecycle_*.
// Here's a list of all variables exposed in my setup.
npm_config_access=
npm_config_allow_same_version=
npm_config_also=
npm_config_always_auth=
npm_config_argv='{"remain":[],"cooked":["run","foo"],"original":["run","foo"]}'
npm_config_auth_type=legacy
@qdm12
qdm12 / README.md
Last active May 2, 2025 20:36
Wireguard and iptables restrictions for multiple users

Wireguard and iptables restrictions for multiple users

If you don't know what Wireguard is, well, you should. It's fast, easy to setup and highly configurable. We will configure Wireguard for multiple users with various restrictions using iptables.

Assumptions

This should fit most setups (not mine though 😉)

@fuero
fuero / refresh-wirehub-config.sh
Created January 23, 2024 15:42
Refresh config from wirehub
#!/bin/bash
set -euo pipefail
IF=<if>
URL="https://wirehub.org/<user>/n/<net>/device/<id>/download?invite_code=<code>"
TMPFILE="$(mktemp)"
SPLITDIR="$(mktemp -d)"
DEST=/etc/wireguard/"$IF".conf
cleanup() {
rm -f "${TMPFILE}"