Skip to content

Instantly share code, notes, and snippets.

View alex-leonhardt's full-sized avatar
❄️

Alex Leonhardt alex-leonhardt

❄️
View GitHub Profile
@alex-leonhardt
alex-leonhardt / tf-example-1.tpl
Last active March 28, 2018 06:14
example-1.tpl
[
{{ range $name, $endpoint := $endpoints }}
{
"$name": "$endpoint",
},
{{ end }}
]
@alex-leonhardt
alex-leonhardt / tf-example.json
Last active March 28, 2018 06:10
example.json
[{
"name": "endpoint1",
"endpoint": "https://endpoint-1.example.com"
},
{
"name": "endpoint2",
"endpoint": "https://endpoint-2.example.com"
},
{
"name": "endpoint3",
@alex-leonhardt
alex-leonhardt / main.go
Created August 11, 2017 16:37
mini golang app to connect and return a message from consul kv
package main
import (
"encoding/json"
"net/http"
consul "github.com/hashicorp/consul/api"
)
func getKVdata() *consul.KVPair {
@alex-leonhardt
alex-leonhardt / statsrv.go
Created November 21, 2016 23:06
statsrv.go a simple static http server to serve your stats.json (or any file really)
/*
statsrv is a very simple static file server in go using the defaul net/http package
Usage:
-p 8080 port to serve on
-d /var/tmp/stats the directory of static files to host
Go to http://localhost:8080 - it will display the index.html or directory listing file.
Place any .json file and it will be served as application/json type document. :)
@alex-leonhardt
alex-leonhardt / riemann.config
Last active June 22, 2016 05:48
dummy config to play with - may be broken - may not be ... who really knows ...
; -*- mode: clojure; -*-
; vim: filetype=clojure
; (logging/init {:console false})
(logging/init :file "riemann.log")
; Listen on the local interface over TCP (5555), UDP (5555), and websockets
; (5556)
(let [host "0.0.0.0"]
(tcp-server {:host host})
@alex-leonhardt
alex-leonhardt / rie.py
Created June 16, 2016 22:00
send random data to riemann for testing
import socket
import time
from functools import wraps
import bernhard
import sys
def wrap_riemann(metric, _host, client=bernhard.Client(), tags=['python']):
def riemann_decorator(f):
@wraps(f)
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# quick pane cycling
unbind ^A
bind ^A select-pane -t :.+
# enable activity alerts
setw -g monitor-activity on
@alex-leonhardt
alex-leonhardt / flask-setup.sh
Last active August 29, 2015 14:01
python flask app template setup
#! /bin/bash
echo "Setting up new flask package layout"
echo -n "Application name: "; read APPNAME
if [ "x$APPNAME" != "x" ]; then
cd ~
HOME=`echo $HOME`