Skip to content

Instantly share code, notes, and snippets.

redbeard brianredbeard

Block or report user

Report or block brianredbeard

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@brianredbeard
brianredbeard / rpm2mc.py
Created Jul 9, 2019
rpm2mc.py - a tool to convert RPMs to Kubernetes machine-configs
View rpm2mc.py
#!/usr/bin/env python3
#
# rpm2mc.py -- Generate a Kubernetes machine-config from an RPM
# Copyright (c) 2019 Brian 'redbeard' Harrington <redbeard@dead-city.org>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
@brianredbeard
brianredbeard / rhcos-urls.py
Created May 31, 2019
Generate URLs for Red Hat CoreOS Images
View rhcos-urls.py
#!/usr/bin/env python3
# requires the requests library:
# pip install requests
import requests
import json
RHCOS_BUILDS="https://raw.githubusercontent.com/openshift/installer/master/data/data/rhcos.json"
@brianredbeard
brianredbeard / quicknum.py
Created May 23, 2019
quicknum - a script to quickly convert/print binary, hex, and decimal numbers
View quicknum.py
#!/usr/bin/env python
import re
import sys
x=sys.argv[1]
# Check to see if the string is only binary
nonbin = re.search(r'[2-9A-Fa-f]', x)
# First, check to see if there were matches in binary, if not
@brianredbeard
brianredbeard / os4-acme-certs.sh
Last active Jul 23, 2019
Script to get Let's Encrypt public facing certs for an OpenShift v4 cluster
View os4-acme-certs.sh
#!/bin/sh
DOMAIN="${1}"
EMAIL="${2}"
if [ "${#}" -ne 2 ]; then
echo "USAGE: os4-acme-certs.sh clustername.basedomain.tld email@example.com"
echo "QUITTING"
exit 1
fi
@brianredbeard
brianredbeard / gh-pubkeys.sh
Created Feb 11, 2019
Github Pubkeys - grab all keys from a list of users to generate an authorized_keys file
View gh-pubkeys.sh
#!/bin/bash
set -e -u -o pipefail
# Provide a default list of users. This can be overriden by supplying the
# environment variable "USERS"
USERS=${USERS:-'brianredbeard chancez crawford ivancherepov kbrwn'}
for name in ${USERS}; do
curl -Ls http://github.com/${name}.keys | \
@brianredbeard
brianredbeard / ext_mirror.sh
Created Sep 26, 2018
Call external script from udev rule - I use this mechanism to fire off xrandr rules when docking my laptop.
View ext_mirror.sh
#!/bin/sh
# This script will make two connected output sources mirrors of each other:
#
#
# +---------------+ +---------------+
# | | | |
# | Primary | | DisplayLink |
# | Display | | (DP-2-2) |
# | (e-DPI-1) | | (Screen 2/3) |
@brianredbeard
brianredbeard / arm64.md
Created Sep 26, 2018 — forked from george-hawkins/arm64.md
Running virtualized x86_64 and emulated arm64 Ubuntu cloud images using QEMU
View arm64.md

QEMU arm64 cloud server emulation

This is basically a rehash of an original post on CNXSoft - all credit (particularly for the Virtio device arguments used below) belongs to the author of that piece.

Download the latest uefi1.img image. E.g. ubuntu-16.04-server-cloudimg-arm64-uefi1.img from https://cloud-images.ubuntu.com/releases/16.04/release/

Download the UEFI firmware image QEMU_EFI.fd from https://releases.linaro.org/components/kernel/uefi-linaro/latest/release/qemu64/

Determine your current username and get your current ssh public key:

@brianredbeard
brianredbeard / doorauth.py
Created Sep 21, 2018
A simple door script for use with github.com/google/makerspace-auth
View doorauth.py
#!/usr/bin/python
#
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@brianredbeard
brianredbeard / ldap.awk
Created Apr 11, 2018
An awk script for LDIF processing
View ldap.awk
# Set the following values before any processing occurs:
# RS (record separator) to an empty line
# FS (field separator) to a newline
# OFS (output field separator) to a comma
BEGIN { RS = "" ; FS = "\n" ; OFS=","}
{ for (i=1;i<=NF;i++) {
# Add a line for each field to be extracted, replacing the field name in
# all three spots:
if ($i ~ "^cn: ") { cn=gensub("^cn: ","","g",$i) }
if ($i ~ "^title: ") { title=gensub("^title: ","","g",$i) }
@brianredbeard
brianredbeard / oshprice.ulp
Created Dec 20, 2017 — forked from itavero/oshprice.ulp
Eagle CAD ULP script to calculate the price of a PCB when you order it at OSHPark.Currently only works for 2-layer boards.
View oshprice.ulp
#usage "en: <b>Calculate the price of a dual-layer PCB if you order them at OSH Park.</b>"
"<p>Usage: run oshprice</p>"
"<p>Author: <author>Arno Moonen &lt;info@arnom.nl&gt;</author><br />"
"Version: <em>201405042026</em></p>"
// THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED
void main() {
if(!board) {
// No board
You can’t perform that action at this time.