Skip to content

Instantly share code, notes, and snippets.

View fionn's full-sized avatar
🦜
wars are waged by technicians

Fionn Fitzmaurice fionn

🦜
wars are waged by technicians
View GitHub Profile
@fionn
fionn / repeat.sh
Created August 22, 2017 15:17
Repeat a Python program until it fails
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "Requires 1 argument; $# given"
exit 1
fi
while true; do
python $1
if [[ $? -ne 0 ]]; then
@fionn
fionn / iperf3.service
Last active September 18, 2021 15:33
iperf server and client
[Unit]
Description=iperf3 server
After=network.target
[Service]
User=nobody
ExecStart=/usr/bin/iperf3 -s --rsa-private-key-path /etc/iperf3/private_not_protected.pem --authorized-users-path /etc/iperf3/iperf.auth
[Install]
WantedBy=multi-user.target
@fionn
fionn / add_credentials.sh
Last active November 4, 2017 07:23
Add a credential file to OpenVPN configurations
#/bin/bash
if [ $(id -u) != 0 ]; then
echo "You must be root"
sudo "$0" "$@"
exit $?
fi
for file in $@; do
sed -i "s|^auth-user-pass$|& /etc/openvpn/client/provider/secret.password|" $file
@fionn
fionn / kernel_ip_forwarding.sh
Last active April 17, 2018 01:35
Set kernel parameters to forward traffic
#!/bin/bash
if [[ $(id -u) -ne 0 ]]; then
echo "You must be root"
exit 1
fi
sysctl -w net.ipv4.ip_forward=1
sysctl -w net.ipv6.conf.all.forwarding=1
[Unit]
Description=Add IPv6 routes
After=network.target
Before=wg-quick@wg0.service openvpn-server@server.service
[Service]
Type=simple
ExecStart=/path/to/ipv6_routing.sh
StandardOutput=syslog
StandardError=syslog
@fionn
fionn / rvi.sh
Created June 24, 2018 15:08
Opens a remote virtual interface
#!/bin/bash
# Remote virtual interface for a single iPhone
udid=$(instruments -s devices | grep -v "Simulator" | grep "iPhone" | awk -F '[][]' '{print $2}')
if [ -z "$udid" ]; then
echo "No UDID found" 1>&2
exit 1
else
echo "Found UDID $udid"
@fionn
fionn / timeout_decorator.py
Created June 26, 2018 15:49
Generic timeout decorator
import sys
import functools
import signal
import logging
def timeout(seconds: int):
def decorator(function):
def handle_timeout(signum, frame):
@fionn
fionn / pdfpw.sh
Created August 23, 2018 21:20
Encrypt PDFs
#!/bin/bash
pw="yellow_submarine"
for arg in $*;
do
base=$(basename $arg .pdf)
pdftk $arg output ${base}_pw.pdf user_pw $pw
done
@fionn
fionn / wlp3s0-SSID
Created August 28, 2018 18:35
WPA2-PEAP-MSCHAPV2 netctl configuration
Description='A descriptive name'
Interface=wlp3s0
Connection=wireless
Security=wpa-configsection
ESSID=SSID
IP=dhcp
WPAConfigSection=(
'ssid="SSID"'
'key_mgmt=WPA-EAP'
'eap=PEAP'
@fionn
fionn / keybase.md
Created September 12, 2018 16:49
Replacement Keybase proof

Keybase proof

I hereby claim:

  • I am fionn on github.
  • I am fionn (https://keybase.io/fionn) on keybase.
  • I have a public key whose fingerprint is BE71 49DD 3EEA 15D8 CD5B D7F6 18E5 CC17 7837 7A29

To claim this, I am signing this object: