Skip to content

Instantly share code, notes, and snippets.

View pawal's full-sized avatar

Patrik Wallström pawal

View GitHub Profile
@pawal
pawal / befores.rules.md
Last active September 26, 2023 09:12
UFW and NAT reflection (hairpin) rules for before.rules, KVM setup with VMs with different services

These are the set of rules for making internal services of a KVM setup be reachable using the public WAN IP addresses of the services from the VMs or local hosts in the local network.

Use case may be a KVM set up, with a bunch of VMs that needs to talk to eachother using the public DNS that contains the public WAN address. Any traffic that goes out to the public WAN IP address will be rewritten to go back to the host responsible for the port. Traffic for these ports originating for internetservices coming from the local network will still be sent out to the Internet through the WAN.

This entire set of rules for enabling this in the before.rules file for the UFW firewall.

  • First part, directing external WAN traffic to internal hosts.
  • Second part, reflecting local traffic going to the WAN IP address to the ports on the local machines.
  • Last part, masquerading local traffic out on the internet using the MASQUERADE rule.
@pawal
pawal / flickering.pde
Created September 16, 2020 12:18
flickering stuff for processing
// flickers and stuff
// by Patrik Wallström in processing
// pawal@amplitut.de 2020-09-16
// user settings
int growthRate = 64; // the higher the faster number of divides
int scanLines = 64; // number of lines per division
// random globals
int x1=1;
0xCd2ba7a9bE8B47D99ED89Eb8aF104eA18C6382E6
@pawal
pawal / c64-processing.js
Last active March 19, 2017 15:06
Rasterbar in Processing
// c64 rasterbars
float y1 = 0;
float y2;
float y3;
float x1;
float xspeed = TWO_PI/222.0;
float yspeed = TWO_PI/233.0;
PFont petFont;
#!/bin/bash
# Given a list of TLDs, fetch their URL from IANA Whois
filename="$HOME/zonefiles/tlds.txt"
server="whois.iana.org"
while read tld; do
url=`whois -h "$server" $tld | grep remarks |grep http| awk -F\ '{print $NF}'`
if [ "$url" ]; then

RIPE-72, Köpenhamn 2016

Göran Marby var på plats och presenterade sig själv och sitt uppdrag på ICANN. Pratade gärna med RIPE-deltagarna om vad Göran ska göra på ICANN.

Rekordhögt deltagande på RIPE-mötet, över 600 deltagare.

Plenary, dag 1

Interconnection in the Nordics, Lasse Jarlskov, TDC

@pawal
pawal / clean-zone.sh
Created April 22, 2016 13:39
Get a list of delegated domains from a zone
#!/bin/sh
awk '{
if (match($0,"^$")) # remove empty lines
skip = $1
else if (match($0,"^;")) # remove comment lines
skip = $1
else if ($1 == "se.") # remove our own zone
skip = $1
else if ($1 == "nu.") # remove our own zone
Verifying that +pawalblipp is my blockchain ID. https://onename.com/pawalblipp
#!/bin/bash
# The file is a newline separated list of domains
# Output is the same list, but with all name servers listed
filename="$1"
while read -r line
do
name="$line"
echo -n "$name:"
#!/usr/bin/env perl
### mockup perl code to run a large number of items without filling the queue
use strict;
use warnings;
use 5.014;
use threads;
use threads::shared;