Skip to content

Instantly share code, notes, and snippets.

@otherwiseguy
otherwiseguy / drserve
Created October 12, 2021 15:35
Get a gnome "critical" notification before your devnest reservation expires
#!/bin/bash
WARN_HOURS=72
while getopts ":t:" opt; do
case ${opt} in
t)
timeout=$OPTARG
;;
esac
done
from multiprocessing.managers import BaseManager
from ovsdbapp.schema.ovn_northbound import commands
class QueueManager(BaseManager): pass
QueueManager.register('get_queue')
m = QueueManager(address=('127.0.0.1', 50000), authkey=b'password')
@otherwiseguy
otherwiseguy / WiderLaunchpdComments.js
Created March 9, 2021 19:51
Remove the width limitation on Launchpad comments
// ==UserScript==
// @name Wider Lauchpad Comments
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Make launchpad comments as wide as possible!
// @author Terry Wilson <[email protected]>
// @match https://bugs.launchpad.net/*/+bug/*
// @grant GM_addStyle
// @run-at document-start
// ==/UserScript==
@otherwiseguy
otherwiseguy / schema_test.py
Created November 12, 2020 01:26
Handle schema changes
import logging
import json
import time
from ovs.db import custom_index
from ovs.db import idl
from ovsdbapp.backend.ovs_idl import connection
from ovsdbapp.backend.ovs_idl import event
from ovsdbapp.backend.ovs_idl import vlog
@otherwiseguy
otherwiseguy / cleanup_routers.sh
Created April 14, 2020 12:44
Clean up routers and dependent objects
set -e
function remove_router {
router=$1
for subnet in $(openstack router show $router -c interfaces_info -f json|jq -r '.interfaces_info | .[] | .subnet_id'); do
for fip in $(openstack floating ip list --router $router -c ID -f value); do
echo Deleting floating ip $fip
openstack floating ip delete $fip &
done
wait
echo Removing subnet $subnet from router $router
# User specific aliases and functions
function ovs_destroy_find() {
local cmd=$1
local table=$2
local condition=$3
eval $cmd "-- destroy $table "{$(ovs-vsctl --no-headings --columns=_uuid -f csv find $table $condition|paste -sd",")}
}
alias nbdf="ovs_destroy_find ovn-nbctl"
alias sbdf="ovs_destroy_find ovn-sbctl"
import abc
import unittest
import six
### base stuff ###
@six.add_metaclass(abc.ABCMeta)
class API(object):
backend = None
import abc
import unittest
import six
### base stuff ###
@six.add_metaclass(abc.ABCMeta)
class API(object):
@abc.abstractproperty
def backend(self):
#!/usr/bin/env python
import abc
import subprocess
import six
from six.moves import urllib
from six.moves import input
class ProtocolRegistry(type):
#!/usr/bin/env python
import logging
import re
import subprocess
import sys
logging.basicConfig()
LOG = logging.getLogger()
try: