This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
import ipaddress | |
subnet = ipaddress.IPv4Network("192.168.0.0/22", strict=False) | |
if subnet.prefixlen > 24: | |
raise ValueError("No Zone for subnets >/24") | |
elif subnet.prefixlen > 16: | |
zone_length = 24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mtusize { | |
#set -x | |
[ -z "$1" ] && { echo "mtusize <host> [<initial data size> <step length>]"; return 1; } | |
ip=$1 | |
size=${2:-1345} | |
step=${3:-64} | |
count=0 | |
minfailed=999999 | |
rstring=("" " failed") | |
while true; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ObjectList(object): | |
def __init__(self, child_objects): | |
self.child_objects = child_objects | |
def __getattr__(self, name): | |
def looper(*args, **kwargs): | |
for obj in self.child_objects: | |
attr = getattr(obj, name) | |
attr(*args, **kwargs) | |
return looper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
# Decode RFC2047 (formerly RFC1342) encoded mail headers | |
# Requires >= python 3.3 | |
import sys | |
from email.header import decode_header | |
def recode_utf8(subj): | |
output = '' | |
for s, enc in decode_header(subj): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Use like: bgpq3 ... stuff | netconf-merge-wrapper.sh | ssh admin@router netconf | |
cat <<_END | |
<rpc> | |
<load-configuration action="merge" format="text"> | |
<configuration-text> | |
_END | |
cat - | |
cat <<_END | |
</configuration-text> |