Skip to content

Instantly share code, notes, and snippets.

View grugnog's full-sized avatar

Owen Barton grugnog

  • CivicActions
  • Oregon, US
View GitHub Profile

Hello world

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In scelerisque sollicitudin arcu in pharetra. Maecenas non aliquet eros, sit amet commodo sapien. Aenean lectus urna, lacinia eget volutpat quis, consectetur at neque. Praesent ut tincidunt urna. Praesent mattis, orci faucibus volutpat pulvinar, massa lacus eleifend purus, venenatis vulputate diam eros et enim. Praesent tortor eros, hendrerit eu dignissim ac, mattis et enim. Aenean posuere mi eget convallis dictum. Suspendisse sagittis dictum mauris in tempus. Proin tempor sapien id turpis pellentesque, in tincidunt massa pulvinar. Aliquam eros augue, sodales id fringilla at, volutpat id eros. Pellentesque elementum tempor turpis id placerat.

In facilisis orci mauris, sit amet facilisis sapien tempor finibus. Donec sit amet fermentum mauris, ac ultrices dolor. Aliquam tortor ipsum, vestibulum eu aliquet quis, posuere sed odio. Aliquam erat volutpat. Cras molestie in metus tristique sodales. Vestibulum urna nibh, consectetur id laoreet ut

@grugnog
grugnog / switch-audio
Created January 17, 2024 23:39
Script to cycle through MacOS audio input/outputs with SwitchAudioSource, with configurable excluded devices
#!/usr/bin/env python3
import subprocess
import json
import sys
# Function to execute a command and return its output
def execute_command(command):
result = subprocess.run(command, stdout=subprocess.PIPE, shell=True)
return result.stdout.decode('utf-8')
# Install these packages (use your favorite AUR tool here)
yay -S minikube kubectl docker-machine-driver-kvm2 libvirt qemu-headless ebtables
# Get libvirt going
sudo systemctl enable libvirtd.service
sudo usermod -a -G libvirt $(whoami)
# This fix thanks to http://blog.programmableproduction.com/2018/03/08/Archlinux-Setup-Minikube-using-KVM/
sudo virsh net-autostart default
@grugnog
grugnog / trellovotecount
Last active October 21, 2022 20:13
Count votes in Trello by person
#!/usr/bin/env bash
if [ -z "${TRELLO_API_KEY}" -o -z "${TRELLO_API_TOKEN}" ]; then
echo "Go to https://trello.com/app-key and export Personal Token as TRELLO_API_KEY, then manually generate a token and export as TRELLO_API_TOKEN"
exit 1
fi
if [ -z "${1}" ]; then
echo "Provide the board ID (8 character alphanumeric from the URL) as an argument"
exit 2
fi
board="${1}"
@grugnog
grugnog / c2md.xsl
Created November 7, 2017 01:23
Converts Confluence multi-page XML export into a Markdown Git repository retaining most formatting, links and version history
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ac="http://www.atlassian.com/schema/confluence/4/ac/"
xmlns:ri="http://www.atlassian.com/schema/confluence/4/ri/"
xmlns:acxhtml="http://www.atlassian.com/schema/confluence/4/"
xmlns:lookup="http://www.fundi.com.au/">
<!--
Original sources/credit:
@grugnog
grugnog / jira2md.xsl
Last active September 8, 2017 20:37
Stylesheet to convert a JIRA report list exported as XML into basic markdown, including all non-empty fields.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Stylesheet to convert a JIRA report list exported as XML into
basic markdown, including all non-empty fields.
To run: saxon-xslt -xsl:jira2md.xsl jira-export.xml
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:functx="http://www.functx.com" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="3.0">
<xsl:output omit-xml-declaration="yes" method="text" indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
@grugnog
grugnog / sussh
Last active May 27, 2021 10:03
Simple expect script to get an interactive root shell using a password from the Lastpass "lpass" tool. Assumes a ssh public key authentication. This allows usage of long, secure passwords to sudo whilst avoiding copy-paste (risky) and passing credentials as command line options (insecure).
#!/usr/bin/expect
set timeout 600
set lpass [lindex $argv 0]
set arguments [lrange $argv 1 end]
if {$lpass eq "" || $arguments eq ""} {
puts "sussh: Login to interactive root shell using sudo password from lpass."
puts "The credential is sent via expect, not via any command line option.\n"
puts "Usage: sussh <lpass-key> <ssh-args ...>"
puts " lpass-key: Suffix of a lpass record with the prefix 'ssh-'"
puts " ssh-args: username, hostname, port, alias or other ssh options\n"
@grugnog
grugnog / civicrm.drush.inc
Created April 3, 2012 14:00
CiviCRM Drush refactoring
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.1 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2011 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |