Skip to content

Instantly share code, notes, and snippets.

View djoreilly's full-sized avatar

Darragh O'Reilly djoreilly

View GitHub Profile
@djoreilly
djoreilly / send-vxlan-loop.py
Last active January 17, 2023 07:12
Reproduce OVS v2.7 memory leak
# send vxlan pkts from netns to ovs on same host
# keep changing the src mac so learn action creates/updates 1000 flows
# ip netns exec ns1 ./send-vxlan-loop.py
import time
from scapy.all import *
# https://home.regit.org/2014/04/speeding-up-scapy-packets-sending/
sock = conf.L2socket(iface='veth-ns')
@djoreilly
djoreilly / wg.md
Last active July 1, 2022 15:54
WireGuard MicroOS Raspberry Pi

WireGuard on MicroOS / Raspberry Pi

Install MicroOS

Download the Raspberry Pi image from https://en.opensuse.org/Portal:MicroOS/Downloads and copy it the MicsoSD card.

# xz -d openSUSE-MicroOS.aarch64-ContainerHost-RaspberryPi.raw.xz
# dd bs=4M if=openSUSE-MicroOS.aarch64-ContainerHost-RaspberryPi.raw of=/dev/mmcblk0 iflag=fullblock oflag=direct status=progress; sync
@djoreilly
djoreilly / stack.yaml
Created February 16, 2018 18:12
Cloudformation example
AWSTemplateFormatVersion: 2010-09-09
# aws cloudformation create-stack --stack-name test-stack --template-body file://stack.yaml
# aws cloudformation describe-stacks --stack-name test-stack
# aws cloudformation describe-stack-events --stack-name test-stack
# aws cloudformation update-stack --stack-name test-stack --template-body file://stack.yaml
Description: VPC, SGs, instances
Parameters:
@djoreilly
djoreilly / Vagrantfile
Last active September 28, 2021 17:30
Vagrant with extra disks
Vagrant.configure("2") do |config|
config.vm.box = "trusty"
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.hostname = "devstack"
# forward ssh keys from main host - handy for gerrit and github
config.ssh.forward_agent = true
@djoreilly
djoreilly / ovs-dump-flows.py
Created August 28, 2015 13:58
Make ovs-ofctl dump-flows more readable. Remove stats, sort by table and priority, replace port numbers with port names.
#!/usr/bin/python
import sys
import re
import subprocess
if len(sys.argv) != 2:
print "bridge name needed"
sys.exit()
@djoreilly
djoreilly / interrupted.go
Last active August 26, 2021 16:01
Prevent shell from sending signals to children and detect if signals caught
package main
import (
"fmt"
"os"
"os/exec"
"os/signal"
"syscall"
"time"
)
@djoreilly
djoreilly / metadata-server.go
Last active March 1, 2021 10:52
Allows Libvirt VMs with cloud-init to get users public ssh key
package main
import (
"flag"
"io"
"io/ioutil"
"log"
"net/http"
"os/user"
"path/filepath"
@djoreilly
djoreilly / keystone_v3_session.py
Created March 1, 2016 11:10
Howto use the python-novaclient and python-neutronclient with Keystone V3
# http://docs.openstack.org/developer/keystoneauth/index.html
# http://www.jamielennox.net/blog/2014/09/15/how-to-use-keystoneclient-sessions/
# In iPython: execfile('path/to/this/file')
import os
import logging
from keystoneauth1.identity import v3
from keystoneauth1 import session
@djoreilly
djoreilly / dump-vm-neutron-info.py
Created January 15, 2020 16:08
Gather neutron info for VM connectivity problems
"""
Script to gather neutron info for vm connectivity problems.
Gets the vm's ports, networks, subnets, security groups
and router, external networks and floatingips.
source .openrc admin
python dump-vm-neutrn-info.py VM_ID
"""
import sys
import os_client_config
# Search nova-compute.log for ports that took a long time
# to receive the network-vif-plugged- event from neutron.
# python find_slow_boot.py /var/log/nov/nova-compute.log | sort -k 3
import datetime
import re
import sys
if len(sys.argv) == 2:
log_file = sys.argv[1]