Skip to content

Instantly share code, notes, and snippets.

View mikepea's full-sized avatar

Mike Pountney mikepea

View GitHub Profile
View mikepea's JQ cheat sheet
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
View Native Go diagnostic toolkit
if [ -z "$GOPATH" ]; then
echo "Doh, GOPATH not set. Bailing"; exit 1
fi
BASE=$(mktemp -d /tmp/diagbuild.XXXXXX)
cd $BASE
# Nice way of visualising network latencies with an http call
# "shameless ripoff" of https://github.com/reorx/httpstat
go get -u github.com/davecheney/httpstat
@mikepea
mikepea / curl_oauth2_weekdone.md
Last active September 24, 2018 18:21
Using cURL to talk OAuth2 to Weekdone
View curl_oauth2_weekdone.md

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
USER=you@example.com
PASSWORD=your_password_here

Login, to get a session cookie

View keybase.md

Keybase proof

I hereby claim:

  • I am mikepea on github.
  • I am mikepea (https://keybase.io/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
mikepea / create_zombie.c
Created February 13, 2015 13:14
C program to create a zombie process - useful for testing monitoring.
View create_zombie.c
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main ()
{
pid_t child_pid;
child_pid = fork ();
if (child_pid > 0) {
@mikepea
mikepea / gist:511ebb8b723f69cea3a4
Created January 12, 2015 11:01
ElasticSearch output of _nodes/stats?pretty -- for analysis of why heap needs to be over 2GB.
View gist:511ebb8b723f69cea3a4
{
"cluster_name" : "elasticsearch",
"nodes" : {
"REDACTED" : {
"timestamp" : 1421060315273,
"name" : "monitoring-02",
"transport_address" : "inet[/REDACTED:9300]",
"host" : "monitoring-02",
"ip" : [ "inet[/REDACTED:9300]", "NONE" ],
"indices" : {
@mikepea
mikepea / pr_etiquette.md
Last active September 29, 2023 17:37
Pull Request Etiquette
View pr_etiquette.md

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
mikepea / gearman_monitoring.md
Last active August 29, 2015 14:11
Monitoring Gearman
View gearman_monitoring.md
@mikepea
mikepea / packmon_user_stories_1.md
Last active August 29, 2015 14:10
Monitoring Pack User Stories v1
View packmon_user_stories_1.md
@mikepea
mikepea / process_states.md
Last active August 29, 2015 14:10
Process State Playbook
View process_states.md

Process State Playbook

Zombies!!!

Zombie processes are created when a child process dies, but due to the parent being blocked cannot provide the exit code back, and hence does not yet get reaped by the kernel.

They are visible in the process table with a 'Z' status.