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 python | |
import ipaddr | |
class IPNetworks(): | |
"""Represent a set of IP ranges. | |
Support testing if an IP addres matches any prefix by simple | |
networks = IPNetworks(['10.0.0.0/8','192.168.0.0/16']) | |
'10.20.30.40' in networks #True | |
""" |
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 | |
# vim: ts=4 expandtab | |
import sys | |
class Peg: | |
""" Stack representing one Hanoi peg. """ | |
def __init__(self, n=0): | |
self.stack = [] | |
self.stack.extend(range(1,n+1)) |
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
BOOTPROTO='static' | |
IPADDR='2001:718:1:fff0:50:56ff:feef:4/64' | |
STARTMODE='onboot' | |
NAME='VMXNET3 Ethernet Controller MGMT' | |
PRE_UP_SCRIPT='local-disablera' | |
POST_UP_SCRIPT='local-postup-pbr6' | |
PRE_DOWN_SCRIPT='local-predown-pbr6' | |
LOCAL_PBR6_PRIO='40001' | |
LOCAL_PBR6_DEFAULTPRIO='60001' |
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
qemu-img convert -O qcow2 -o preallocation=off -p RIPEDB-disk1.vmdk RIPEDB-disk1.qcow2 |
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 | |
IP="/bin/ip" | |
function prepare_rt_table() { | |
local rttables=/etc/iproute2/rt_tables | |
local iface=$1 | |
[[ "${iface}" = 'lo' ]] && return | |
if ! egrep -q "\s${iface}\s*"\$ $rttables; then | |
idx=$(wc -l <$rttables) |
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 lxml.etree | |
tree = lxml.etree.parse('pl.kml') | |
root = tree.getroot() | |
ns= 'http://earth.google.com/kml/2.1' | |
pmarks = tree.findall('//{{{0}}}Placemark'.format(ns)) | |
for pmark in pmarks: | |
coor= pmark.find('{{{0}}}Point/{{{0}}}coordinates'.format(ns)) | |
long, lat, alt = (float(x) for x in coor.text.split(',',3)) |
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 python | |
import subprocess | |
import shlex | |
import sys | |
import signal | |
sys.stdout.write("""Content-Type: audio/mpeg\r | |
icy-br:192\r | |
ice-audio-info: ice-samplerate=48000;ice-bitrate=192;ice-channels=2\r |
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 email.mime.text | |
import email.utils | |
import email.header | |
import smtplib | |
import copy | |
import sys | |
import re | |
import argparse |
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 | |
allocurl="ftp://ftp.ripe.net/pub/stats/ripencc/membership/alloclist.txt" | |
#The workdir have to exist and be empty! It's content will be deleted after each run. | |
workdir="/var/tmp/czalloc" | |
function alloc2lir() { | |
local dstdir="$1" | |
local lirfile="" | |
while read line; 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
#!/usr/bin/env python3 | |
import argparse | |
import collections | |
import re | |
parser = argparse.ArgumentParser( | |
description='Find a word consisting of certain letters in dictionary' | |
) | |
parser.add_argument('letters', |
OlderNewer