Skip to content

Instantly share code, notes, and snippets.

Avatar

redbeard brianredbeard

View GitHub Profile
@brianredbeard
brianredbeard / mpris.py
Created Sep 21, 2020 — forked from FergusInLondon/mpris.py
Retrieve data from a Media Player in Linux, via dbus. (Uses Python)
View mpris.py
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
@brianredbeard
brianredbeard / sdc_raw_libaio_direct.fio
Created May 14, 2020 — forked from tcooper/sdc_raw_libaio_direct.fio
FIO test script for raw device, ioengine=libaio, oflag=direct
View sdc_raw_libaio_direct.fio
[global]
ioengine=libaio
invalidate=1
ramp_time=30
iodepth=1
runtime=180
time_based
direct=1
[write-sdc-4k-seq]
@brianredbeard
brianredbeard / pine64-battery.sh
Last active Aug 23, 2019 — forked from pfeerick/pine64-battery.sh
Colourful Battery Status script for Pine64 SOC board
View pine64-battery.sh
#!/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 / 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 / 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
@brianredbeard
brianredbeard / upgrade_unifi.sh
Last active Sep 21, 2016 — forked from stevejenkins/upgrade_unifi.sh
Easy UniFi Controller Upgrade Script for Unix/Linux Systems
View upgrade_unifi.sh
#!/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 / logstash.sh
Last active Dec 23, 2015 — 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.
View logstash.sh
#!/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 / sshpub-to-rsa
Created Jan 26, 2012 — 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)
View sshpub-to-rsa
#!/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