Skip to content

Instantly share code, notes, and snippets.

View Arch linux minikube kvm2 setup
# 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
Created Sep 24, 2018
Count votes in Trello by person
View trellovotecount
#!/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 TRELLO_API_KEY and TRELLO_API_TOKEN"
exit 1
fi
for id in $(curl -s "https://api.trello.com/1/boards/EUW423vW/cards?key=$TRELLO_API_KEY&token=$TRELLO_API_TOKEN&limit=1000" | jq -r '.[] | .id'); do
curl -s "https://api.trello.com/1/cards/$id/membersVoted?key=$TRELLO_API_KEY&token=$TRELLO_API_TOKEN" | jq '.[] | .fullName'
sleep 0.5
done | sort | uniq -c | sort -n
@grugnog
grugnog / c2md.xsl
Created Nov 7, 2017
Converts Confluence multi-page XML export into a Markdown Git repository retaining most formatting, links and version history
View c2md.xsl
<?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 Sep 8, 2017
Stylesheet to convert a JIRA report list exported as XML into basic markdown, including all non-empty fields.
View jira2md.xsl
<?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 Nov 5, 2020
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).
View sussh
#!/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 Apr 3, 2012
CiviCRM Drush refactoring
View civicrm.drush.inc
<?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 |
You can’t perform that action at this time.