Skip to content

Instantly share code, notes, and snippets.

View sw00's full-sized avatar

Sett sw00

View GitHub Profile
@sw00
sw00 / pipdeptree.py
Created January 15, 2019 08:20
Patched pipdeptree so --reverse, --packages and --graph-output flags work together.
from __future__ import print_function
import os
import sys
from itertools import chain
from collections import defaultdict
import argparse
from operator import attrgetter
import json
from importlib import import_module
@sw00
sw00 / bootstrap_network.sh
Last active July 9, 2019 20:52
Bash script to configure routes so that host can still serve traffic over its public IP interface while VPN is on.
#!/bin/bash
set -xe
calculate_subnet() {
IP=$1
PREFIX=$2
{ IFS=. read -r i1 i2 i3 i4; } <<< $IP
{ IFS=. read -r xx m1 m2 m3 m4; } <<< $(for a in $(seq 1 32); do if [ $(((a - 1) % 8)) -eq 0 ]; then echo -n .; fi; if [ $a -le $PREFIX ]; then echo -n 1; else echo -n 0; fi; done)
printf "%d.%d.%d.%d\n" "$((i1 & (2#$m1)))" "$((i2 & (2#$m2)))" "$((i3 & (2#$m3)))" "$((i4 & (2#$m4)))"
@sw00
sw00 / sett.pubkey.asc
Created May 4, 2021 23:14
PGP Public Key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGNBF12A68BDAC6TJidwDHYotVuDxz6egEPAXDmDadyEL2AxZcc9Ugpcv29jIwI
3b5g+uWZexXhEqqYsW3JHeVD5Anm2JzOXCSzEY8sAX7UD5wcFC30MJfgpTNU1nPl
hEP7b8d56AlVDjrrffFD2BzI+TaBKEUPIoQsaOZlICuPZji8yacG+LjYZGn9v+Rt
K2VDqcan7E4KQQjF/lIZJCMDThJyHw2NCkiLK9JK/gZs/VukLUr31KukzZw2WKWY
3FAcUXQmY86r+7r6lMqcwlM2UazQh9AtY/d27MEJP/zHj7znZVjgOUkDDqNxcnKp
S4YxkuqtkYrXIyvlrLrWxkIRkFX14PJrLxbAoufOdjclIgauDBAWU1DSS7urFLIG
fgoxE/dWhJ1hu5TVRIx7oJ5IhiZOBJthJE9rPFORj2pIK/EA3knnDsHrzTJH+8AQ
cJnaqjWADiFjWawVpLw491l+CmeuvbLACN59F0zpq/1n5KLRG/5N0sxVwblPxBif