Skip to content

Instantly share code, notes, and snippets.

server {
server_name grafana.*;
root /usr/share/grafana;
access_log /var/log/nginx/grafana-access.log timed_combined;
access_log /var/log/nginx/grafana-json.event.access.log json_event;
error_log /var/log/nginx/grafana-error.log;
location =/config.js {
alias /etc/grafana/config.js;
#!/usr/bin/env bash
set -eu
user=$1
size=128
url=$(curl https://api.github.com/users/${user} | jq -r '.avatar_url')
wget -O "${user}.jpg" "${url}&s=${size}"
---
jobs:
- name: test
plan:
- task: hello
config:
platform: linux
image_resource:
type: docker-image
source: {repository: alpine}
@dcarley
dcarley / with-jq.sh
Created April 7, 2016 16:59
awscli --query vs. jq
subscribed=$(aws sns list-subscriptions | jq -c ".[][] | select(.TopicArn | contains(\"${topic_arn}\")) | .Endpoint" | tr -d \")
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"regexp"
"github.com/concourse/atc"
@dcarley
dcarley / gist:2db86780eb99c2586f4b
Created February 12, 2016 14:18
cat disagrees
➜ paas-cf git:(master) ✗ git di | cat
diff --git a/manifests/bosh-manifest/spec/fixtures/bosh-secrets.yml b/manifests/bosh-manifest/spec/fixtures/bosh-secrets.yml
index b79dc79..61a0c42 100644
--- a/manifests/bosh-manifest/spec/fixtures/bosh-secrets.yml
+++ b/manifests/bosh-manifest/spec/fixtures/bosh-secrets.yml
@@ -7,4 +7,5 @@ secrets:
bosh_redis_password: BOSH_REDIS_PASSWORD
bosh_blobstore_director_password: BOSH_BLOBSTORE_DIRECTOR_PASSWORD
bosh_hm_director_password: BOSH_HM_DIRECTOR_PASSWORD
- bosh_admin_password: BOSH_ADMIN_PASSWORD
@dcarley
dcarley / after.txt
Last active January 1, 2016 05:39
Testing Fastly's API authentication
➜ ~ go run test_fastly_api_auth.go -user ${FASTLY_USER} -pass ${FASTLY_PASS}
200 OK
Took 469.833754ms
➜ ~ go run test_fastly_api_auth.go -user ${FASTLY_USER} -pass ${FASTLY_PASS}
200 OK
Took 995.766412ms
➜ ~ go run test_fastly_api_auth.go -user ${FASTLY_USER} -pass ${FASTLY_PASS}
200 OK
Took 835.970521ms
➜ router git:(master) ✗ ulimit -n
256
rate 2800 rps latencies
{"latencies"=>
{"mean"=>933760, "95th"=>5358752, "99th"=>60440999, "max"=>60440999},
"bytes_in"=>{"total"=>280000, "mean"=>10},
"bytes_out"=>{"total"=>0, "mean"=>0},
"duration"=>10571394282,
"requests"=>28000,
@dcarley
dcarley / gist:7264030
Created November 1, 2013 11:14
Router performance test
Starting router on port: 3169, api_port: 3168
Rate: 1000 rps
2013/11/01 11:05:18 Vegeta is attacking 2 targets in random order for 1m0s...
2013/11/01 11:06:18 Done!
2013/11/01 11:06:18 Writing results to 'stdout'...
Rate: 1000 rps
2013/11/01 11:06:18 Vegeta is attacking 2 targets in random order for 1m0s...
2013/11/01 11:07:19 Done!
@dcarley
dcarley / collect_elasticsearch.conf.erb
Created July 5, 2013 13:03
collectd configuration for querying Elasticsearch using curl_json plugin
<Plugin curl_json>
<URL "http://127.0.0.1:<%= es_port -%>/_cluster/nodes/_local/stats?http=true&process=true&jvm=true&transport=true">
Instance "elasticsearch"
<%
stats = {
"counter" => [
"indices.cache.field_evictions",
"indices.cache.filter_count",
"indices.cache.filter_evictions",