Skip to content

Instantly share code, notes, and snippets.

View wolsen's full-sized avatar

Billy Olsen wolsen

View GitHub Profile
#!/usr/bin/env python3
#
# Used to configure VRFs for Juju management services.
#
import netifaces
import ipaddress
import subprocess
import textwrap
import yaml
@wolsen
wolsen / cprocess.py
Last active February 4, 2023 10:25
quick cmd runner for ops framework
import subprocess
import textwrap
import time
import typing
import weakref
from ops import model
from ops import pebble
import uuid
@wolsen
wolsen / snapcraft.yaml
Created May 9, 2020 17:19
OpenRocket snapcraft.yaml expanded to include extension information
name: openrocket
adopt-info: openrocket
grade: stable
summary: A free, fully featured model rocket simulator.
description: |
OpenRocket is a free, fully featured model rocket simulator that allows you
to design and simulate your rockets before actually building and flying them.
The main features include
@wolsen
wolsen / create-ldap-users.py
Created December 2, 2017 01:59
Create lots of users for an openldap server
import ldap
import ldap.modlist
con = ldap.initialize('ldap://10.5.0.15')
con.simple_bind_s('cn=admin,dc=test,dc=com', 'crapper')
ldap_base = 'dc=test,dc=com'
query = '(uid=johndoe)'
result = con.search_s(ldap_base, ldap.SCOPE_SUBTREE, query)
@wolsen
wolsen / keybase.md
Created August 1, 2017 21:04
keybase.md

Keybase proof

I hereby claim:

  • I am wolsen on github.
  • I am wolsen (https://keybase.io/wolsen) on keybase.
  • I have a public key ASCBwCXQJkSbnyJ_4AvloA9Qs6plP0vg_Z9PpGK7w2qmIwo

To claim this, I am signing this object:

@wolsen
wolsen / create-external-journal.sh
Created January 12, 2017 22:35
Re-creates external journals for Ceph OSDs
#!/bin/bash
stop ceph-osd-all
part_num=0
journal_disk=/dev/vdb
jsize=512M
osds="1 2"
for i in $osds
nova list --fields name,Networks | awk '/juju/ { n = split($6,array,"="); printf "%s %s.openstacklocal\n", array[n], $4 }'
@wolsen
wolsen / cmadison.py
Last active May 12, 2016 19:18
rmadison + cloud-archive madison
#!/usr/bin/env python
#
# Provides a rather basic version of rmadison (or dak ls if you prefer)
# for the Ubuntu cloud-archive.
#
# This script works in the following manner:
# 1) It will show the rmadison output for the selected package to show
# the values of packages within the main ubuntu archives
# 2) It will show similar output for the selected package in the ubuntu
# cloud archives.
# Download the trusty cloud image to create the vm from
wget https://cloud-iamges.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img
# Create a template volume which we can use to create new images
# from (prevents from having to re-download the template any time
# we make a change)
virsh vol-create-as --pool default trusty-template-volume.img 3G
virsh vol-upload --pool default --file trusty-server-cloudimg-amd64-disk1.img \
--vol trusty-template-volume.img
@wolsen
wolsen / generator.py
Created June 11, 2015 20:30
generate-vms-quickly
#!/usr/bin/env python
import six
import subprocess
import types
import yaml
PARAM_MAPPING = {
'name': '--name',
'arch': '--arch',