Skip to content

Instantly share code, notes, and snippets.

View wido's full-sized avatar

Wido den Hollander wido

View GitHub Profile
@wido
wido / make-ixpe-uefi-iso.sh
Created August 31, 2022 07:48
Make iPXE UEFI Boot ISO
#!/bin/bash
#
# Put this script in the source directory of the ipxe project
#
# The output ipxe-uefi.iso can be used to boot a server with iPXE
#
cd `dirname $0`
cd src
make bin-x86_64-efi/ipxe.efi
cd ..
@wido
wido / deploy-vms.py
Created June 20, 2022 07:40
Deploy Virtual Machines in CloudStack with python3
#!/usr/bin/env python3
from cs import CloudStack
URL = 'https://xxx.yyyy.zzz/client/api'
APIKEY = 'XXXXXXXXXXXXXX'
SECRETKEY = 'YYYYYYYYYYYYYYYYY'
# NAT Network 1
NETWORKID = '68c537ba-3e30-4498-9fbb-d433aae7bbda'
@wido
wido / cloudflare_dns_to_freeipa.py
Created May 18, 2022 12:01
Parse DNS export from CloudFlare to import into FreeIPA
#!/usr/bin/python3
import argparse
def parse_line(line):
if not line:
return
if line[0] == ';':
return
@wido
wido / modifyvxlan.sh
Created June 7, 2021 13:31
BGP+EVPN+VXLAN with Apache CloudStack
#!/usr/bin/env bash
#
# Use BGP+EVPN for VXLAN with CloudStack instead of Multicast
#
# Place this file on all KVM hypervisors at /usr/share/modifyvxlan.sh
#
# More information about BGP and EVPN with FRR: https://vincent.bernat.ch/en/blog/2017-vxlan-bgp-evpn
#
DSTPORT=4789
@wido
wido / ip-family-traffic-counter.py
Last active October 22, 2020 08:42
Count IPv4 vs IPv6 traffic flowing over a Linux bridge
#!/usr/bin/python3
#
# I have a Linux machine between my ISP's router and my switch. Two interfaces
# are bridged so I can inspect all traffic coming in and going out.
#
#
# bridge name bridge id STP enabled interfaces
# br1 8000.8eb20d8d9b94 no enp0s20f0
# enp0s20f1
#
@wido
wido / ceph-osd-compact.sh
Created March 11, 2020 20:04
Compact all Ceph OSDs on a host
#!/bin/bash
#
# Compact all OSDs on a host while they are stopped/offline
#
# Author: Wido den Hollander <wido@denhollander.io>
#
df|grep "/var/lib/ceph/osd"|awk '{print $6}'|cut -d '-' -f 2|sort -n|xargs -n 1 -P 10 -I OSD ceph-kvstore-tool bluestore-kv /var/lib/ceph/osd/ceph-OSD compact
@wido
wido / powerdns-lua-records.txt
Created February 13, 2020 13:57
PowerDNS Lua records
# These are just some LUA records I was testing with for PowerDNS
#
# Author: Wido den Hollander <wido@denhollander.io>
A "ifportup(25, {'185.66.250.201', '185.87.186.222'})"
A "ifportup(25, {'185.66.250.201', '185.87.186.222'}, {selector='all'})"
AAAA "ifportup(25, {'2a00:f10:121:a00:4f8:84ff:fe00:1846', '2a00:f10:400:2:488:56ff:fe00:74f'})"
AAAA "ifportup(25, {'2a00:f10:121:a00:4f8:84ff:fe00:1846', '2a00:f10:400:2:488:56ff:fe00:74f'}, {selector='all'})"
@wido
wido / hue-curl.sh
Created January 6, 2020 20:11
Philips Hue control with cURL
#!/bin/bash
#
# Simple script to change lights on Philips Hue using cURL
#
# Source: http://hkionline.net/posts/using-phillips-hue-from-the-command-line
#
# Author: Wido den Hollander <wido@denhollander.io>
#
# YES! Philips Hue also talks IPv6! :-)
@wido
wido / ip6-eui64-address.py
Created November 13, 2019 10:41
Calculate RFC482 (SLAAC) IPv6 address a host will obtain
#!/usr/bin/env python3
#
# Calculate the IPv6 address a host will obtain per RFC4862
#
# Usage: ./ip6-eui64-address.py --prefix 2001:db8::/64 52:54:00:59:c2:b3
#
# Author: Wido den Hollander <wido@denhollander.io>
#
import argparse
import ipaddress
@wido
wido / ceph-failed-osd-start.sh
Created November 11, 2019 11:00
Start all failed Ceph OSDs
#!/bin/sh
#
# Start all OSDs on a host which didnt start for some reason
#
# Author: Wido den Hollander <wido@denhollander.io>
#
df -h|grep ceph|grep osd|awk '{print $6}'|cut -d '-' -f 2|sort -n|xargs -n 1 -I OSD systemctl reset-failed ceph-osd@OSD
df -h|grep ceph|grep osd|awk '{print $6}'|cut -d '-' -f 2|sort -n|xargs -n 1 -I OSD systemctl start ceph-osd@OSD