Python and your firewall

I wrote a script in python that sets ufw rules to allow local network access but require all other traffic to be routed over a vpn interface. This is useful if you want to force all traffic to be sent over vpn from your linux machine except local network traffic (for local ssh access and the like). The snippet can be found here on gitlab: https://gitlab.com/snippets/1524634 You can run –help and see the arguments. You’ll have an option to review the ruleset before it applies it as well. Enjoy!

Fun with the Raspberry Pi

I spent some time this weekend doing a morse code encoder in python on the Raspberry Pi. You run the program, type in what you want to say and it gets translated into long and short beeps in light (or relay) in morse code.

I should develop an actual image at some point for how to wire this up. I have a wire from gpio pin 7 -> led -> resister -> ground for this program. I also have a relay module attached to gpio pin 7 -> relay in1 that makes a satisfying click as well.

The code snippet can be found here on gitlab: https://gitlab.com/snippets/1547397