Skip to content

Instantly share code, notes, and snippets.

View mikepea's full-sized avatar

Mike Pountney mikepea

View GitHub Profile
mikepea /
Last active July 7, 2024 16:11
Pull Request Etiquette

Pull Request Etiquette

Why do we use a Pull Request workflow?

PRs are a great way of sharing information, and can help us be aware of the changes that are occuring in our codebase. They are also an excellent way of getting peer review on the work that we do, without the cost of working in direct pairs.

Ultimately though, the primary reason we use PRs is to encourage quality in the commits that are made to our code repositories

Done well, the commits (and their attached messages) contained within tell a story to people examining the code at a later date. If we are not careful to ensure the quality of these commits, we silently lose this ability.

mikepea / gist:07b1cede92c119e4f297
Last active February 24, 2022 10:53
Grafana Scripted Dashboard example for collectd with SeparateInstances and StoreRates enabled
/* global _ */
* Complex scripted dashboard
* This script generates a dashboard object that Grafana can load. It also takes a number of user
* supplied URL parameters (int ARGS variable)
* Global accessable variables
* window, document, $, jQuery, ARGS, moment
* Return a dashboard object, or a function
mikepea /
Last active September 24, 2018 18:21
Using cURL to talk OAuth2 to Weekdone

You'll need to register an 'app' with Weekdone, as per their API docs.

CLIENT_ID={provided by weekdone app registration}
CLIENT_SECRET={provided by weekdone app registration}
REDIRECT_URL=https://localhost   # this does not need to be valid, we just use it to snag the auth code

Login, to get a session cookie

gron # greppable JSON encoder/decoder
jq -r '{query}' # raw output, strips quotes et al. good for pipelining into grep.
jq -r 'keys | .[]' # lists just the keys of a map
if [ -z "$GOPATH" ]; then
echo "Doh, GOPATH not set. Bailing"; exit 1
BASE=$(mktemp -d /tmp/diagbuild.XXXXXX)
cd $BASE
# Nice way of visualising network latencies with an http call
# "shameless ripoff" of
go get -u
mikepea / gist:8491609
Last active January 3, 2016 16:49
Setting up a Raspberry Pi for headless Arduino fun
sudo apt-get install arduino-core arduino-mk
sudo apt-get install screen
sudo apt-get install git
cd /usr/share/arduino/libraries
sudo git clone

Keybase proof

I hereby claim:

  • I am mikepea on github.
  • I am mikepea ( on keybase.
  • I have a public key whose fingerprint is 3857 87BA EE71 AB5B 7835 CA7B 8B37 DA12 6948 DC9D

To claim this, I am signing this object:

mikepea / overview.js
Created November 11, 2014 20:17
Grafana scripted dashboard: node overview
/* global _ */
* Grafana Scripted Dashboard to:
* * Give overview of all nodes in a cluster: CPU, Load, Memory
* * Provide links to other - more complex - dashboard for each node.
* Global accessable variables
* window, document, $, jQuery, ARGS, moment
* Return a dashboard object, or a function
mikepea / gist:637418
Created October 20, 2010 22:01
beginnings of NEC IR code
void send_38khz_pulse(void) {
PORTB ^= irOut;
PORTB ^= redMask;
delay_x_us(26); // 17 works
void send_38khz_space(void) {
PORTB ^= bogusMask;
PORTB ^= bogusMask;
delay_x_us(26); // 17 works
diff --git a/lib/mcollective/util.rb b/lib/mcollective/util.rb
index abd5791..6870709 100644
--- a/lib/mcollective/util.rb
+++ b/lib/mcollective/util.rb
@@ -55,10 +55,19 @@ module MCollective
# If the passed value starts with a / it's assumed to be regex
# and will use regex to match
def self.has_fact?(fact, value)
- value ="\/", "")) if value.match("^/")