Skip to content

Instantly share code, notes, and snippets.

View jcabmora's full-sized avatar

Jorge Cabrera jcabmora

View GitHub Profile
@jcabmora
jcabmora / testheroicquery.sh
Created May 26, 2016 01:11
Script to test Heroic's query/metrics API
#!/bin/bash
echo "Execution time:$(date)"
#step 1: get an approximation of the server date in millis
DATE0=`curl -s -H "Content-Type: application/json" http://localhost:8080/query/metrics -d '{"range": {"type": "relative", "unit": "SECONDS", "value": 1}}' | jq -r '.range.end'`
echo "Now: $DATE0"
#step 2: call write API
@jcabmora
jcabmora / gist:1e13cafd8459b123aa5e4a161f47c136
Created October 23, 2019 20:17
When that service uses too much CPU...
while true; do top -b -p 12472 -n1 | tail -1 >> cpuhog.log ; sleep 1; done
@jcabmora
jcabmora / buggy.go
Created January 29, 2021 01:11
subtle bug
package main
import (
"bufio"
"fmt"
"os"
)
// test it:
// eval printf '...............%s\\n' `printf '{#..$}%.0s' {1..16}` | go run buggy.go