Skip to content

Instantly share code, notes, and snippets.

View mikepea's full-sized avatar

Mike Pountney mikepea

View GitHub Profile

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

Login, to get a session cookie

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
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