Skip to content

Instantly share code, notes, and snippets.

View martinkennelly's full-sized avatar

Martin Kennelly martinkennelly

View GitHub Profile
class JsonExtractor:
"""
Computationally poor json string search. Searches through a string to find valid JSON(s) and returns any found in a list.
"""
def __init__(self,toBeParsed):
if type(toBeParsed) != str:
raise TypeError
self.data = toBeParsed
Verifying my Blockstack ID is secured with the address 1Ew1PKMPh78TEdMUmGqDzDtFuurLsSppsk https://explorer.blockstack.org/address/1Ew1PKMPh78TEdMUmGqDzDtFuurLsSppsk
@martinkennelly
martinkennelly / install_git_lfs_v1.sh
Created November 11, 2019 18:19
Install git lfs on ubuntu 18.04
#!/bin/bash -x
# tested on ubuntu 18.04
# 11/11/19
set -e
curdir="$(pwd)"
cd /tmp
tempdir=$(mktemp -d)
cd $tempdir
wget -q https://github.com/git-lfs/git-lfs/releases/download/v2.9.0/git-lfs-linux-amd64-v2.9.0.tar.gz
tar -xf git-lfs-linux-amd64-v2.9.0.tar.gz
@martinkennelly
martinkennelly / hexchat_login_delay
Last active November 17, 2019 16:09
Configuring hexchat for privileged channel login
I was having trouble auto logging into irc channels that required a user to login to the network the channel was attached to so I added commands to delay the joining to these channels to give time for authentication to complete.
-> Edit the network you wish to join
-> Switch to the 'Connect commands' tab
-> First command should be: 'msg NickServ identify %p'
-> For each channel you wish to auto join add command: 'timer repeat -1 9 join #openstack-cinder'
@martinkennelly
martinkennelly / Generating BPF helper function
Last active January 26, 2020 22:15
eBPF helper functions documentation - linux kernel ver. 5.3.13
A great function for generating latest kernel doc or man page for bpf helper functions
> ./scripts/bpf_helpers_doc.py --filename include/uapi/linux/bpf.h > /tmp/bpf_helpers_docs.rst
> rst2man.py /tmp/bpf_helpers_docs.rst > /tmp/bpf_helpers_docs.man
> man /tmp/bpf_helpers_docs.man
#!/bin/bash
# output all ovn-kubernetes components logs to file from a must-gather output
# set --location flag to must-gather output location
set -eo pipefail
location=""
#!/bin/bash
set -eo pipefail
if [ "$#" -ne 2 ]; then
echo "you need to pass two arguments - $0 LOCAL_FILE_PATH TARGET_FILE_PATH"
exit 1
fi
if ! [ -x "$(command -v oc)" ]; then
echo "you need oc installed"
#!/bin/bash
NAMESPACE="openshift-ovn-kubernetes"
KUBE_NODE_CONTAINERS=("ovn-acl-logging" "ovn-controller" "ovnkube-node")
KUBE_MASTER_CONTAINERS=("kube-rbac-proxy" "nbdb" "northd" "ovn-dbchecker" "ovnkube-master" "sbdb")
dir=$(mktemp -d)
sleep_duration=${SLEEP_DURATION:-20}
i=1
echo "log base temp directory: '$dir'"
read -n 1 -p "hit enter when ready to record pods logs contineously until interupt every $sleep_duration seconds: "
# OVN Controller
Enable JSON RPC debug logs: ovn-appctl -t ovn-controller vlog/set jsonrpc:dbg
Claim OVS port IF all conditions true:
1. iface-id and iface-id-ver is set on the OVS interface
2. OVS interface has ofport > 0
3. ovn-controller has seen the port_binding for pod logical port in SB DB
Release OVS port IF any of conditions true:
1. iface-id / iface-id-ver is deleted or updated to a different value
2. port_binding row is deleted in SB DB