Skip to content

Instantly share code, notes, and snippets.

View brianredbeard's full-sized avatar

redbeard brianredbeard

View GitHub Profile
@brianredbeard
brianredbeard / sshpub-to-rsa
Created January 26, 2012 15:16 — forked from thwarted/sshpub-to-rsa
converts an openssh RSA public key into a format usable by openssl rsautl (if you don't have openssh 5.6 or later with ssh-keygen PEM export format)
#!/usr/bin/env python
# with help and inspiration from
# * ASN1_generate_nconf(3) (specifically the SubjectPublicKeyInfo structure)
# * http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL
# * http://blog.oddbit.com/2011/05/converting-openssh-public-keys.html
import sys
import base64
import struct
@brianredbeard
brianredbeard / logstash.sh
Last active December 23, 2015 05:49 — forked from slojo404/logstash RPM spec
Updated to more closely follow Linux Standard Build (lsb; http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html) practices as well as more clearly abstract the function of the agent to support separate scripts for shippers, indexers, etc.
#!/bin/bash
#
# logstash Startup script for logstash
# chkconfig: 2345 20 80
# description: Logstash is a log shipping, indexing, and collocation tool.
# processname: java
### BEGIN INIT INFO
# Provides: logstash
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
@brianredbeard
brianredbeard / upgrade_unifi.sh
Last active September 21, 2016 02:17 — forked from stevejenkins/upgrade_unifi.sh
Easy UniFi Controller Upgrade Script for Unix/Linux Systems
#!/bin/sh
# upgrade_unifi.sh
# Easy UniFi Controller Upgrade Script for Unix/Linux Systems
# by Steve Jenkins (stevejenkins.com)
# Version 2.0
# Last Updated July 2, 2016
# REQUIREMENTS
# 1) Assumes you already have any version of UniFi Controller installed
@brianredbeard
brianredbeard / oshprice.ulp
Created December 20, 2017 16:34 — 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.
#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
@brianredbeard
brianredbeard / arm64.md
Created September 26, 2018 00:58 — forked from george-hawkins/arm64.md
Running virtualized x86_64 and emulated arm64 Ubuntu cloud images using QEMU

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 / pine64-battery.sh
Last active August 23, 2019 23:32 — forked from pfeerick/pine64-battery.sh
Colourful Battery Status script for Pine64 SOC board
#!/bin/bash
SWITCH="\033["
NORMAL="${SWITCH}0m"
RED="${SWITCH}1;31m"
GREEN="${SWITCH}1;32m"
YELLOW="${SWITCH}1;33m"
PURPLE="${SWITCH}1;35m"
BLUE="${SWITCH}1;34m"
CYAN="${SWITCH}1;36m"
@brianredbeard
brianredbeard / sdc_raw_libaio_direct.fio
Created May 14, 2020 16:11 — forked from tcooper/sdc_raw_libaio_direct.fio
FIO test script for raw device, ioengine=libaio, oflag=direct
[global]
ioengine=libaio
invalidate=1
ramp_time=30
iodepth=1
runtime=180
time_based
direct=1
[write-sdc-4k-seq]
@brianredbeard
brianredbeard / mpris.py
Created September 21, 2020 04:35 — forked from FergusInLondon/mpris.py
Retrieve data from a Media Player in Linux, via dbus. (Uses Python)
import dbus
class MediaPlayer:
"""Recieves state from a MediaPlayer using dbus."""
player_properties = False
def __init__(self, player_name):
# Get an instance of the dbus session bus, and retrieve
# a proxy object for accessing the MediaPlayer