Skip to content

Instantly share code, notes, and snippets.

View relistan's full-sized avatar

Karl Matthias relistan

View GitHub Profile
@relistan
relistan / bootcfg_esxi55.template
Created December 4, 2013 19:33
VMWare ESXi Server 5.5 for DELL - Cobbler Configs
bootstate=0
title=Loading ESXi installer
prefix=$img_path
kernel=tboot.b00
#if $getVar('system_name','') != ''
#set $what = "system"
#else
#set $what = "profile"
#end if
kernelopt=ks=http://$server:$http_port/cblr/svc/op/ks/$what/$name
@relistan
relistan / gist:9648383
Last active August 29, 2015 13:57
Inspect the remotes for a directory full of git repos, filtering for newrelic
#!/bin/bash
REPOS=""
for config in `find . -maxdepth 3 -name config | grep '.git'`; do
egrep "github.com:newrelic|github.com/newrelic" $config > /dev/null
if [[ $? -eq 0 ]]; then
repo_dir=`dirname $(dirname ${config})`
REPOS="${REPOS} `basename ${repo_dir}`"
fi
done
@relistan
relistan / gist:53be1fc306543df4ffdd
Created May 29, 2014 18:37
etcd service discovery and configuration schema
client.set('/services/fooservice/ports/3021', value: 9292)
client.set('/services/fooservice/env/TESTING_URL', value: 'http//foo.com/asdf')
client.set('/services/fooservice/hosts/chi-staging-foo-1.nr-ops.net', value: 'up')
client.set('/services/fooservice/hosts/chi-staging-foo-2.nr-ops.net', value: 'up')
client.set('/services/fooservice/hosts/chi-staging-foo-3.nr-ops.net', value: 'down')
client.set('/services/fooservice/endpoints/chi-staging-foo-1.nr-ops.net', value: 'http://chi-staging-foo-1.nr-ops.net:3021/')
client.set('/services/fooservice/endpoints/chi-staging-foo-2.nr-ops.net', value: 'http://chi-staging-foo-2.nr-ops.net:3021/')
client.set('/services/fooservice/endpoints/chi-staging-foo-3.nr-ops.net', value: 'http://chi-staging-foo-3.nr-ops.net:3021/')
@relistan
relistan / Services Layout.md
Last active August 29, 2015 14:02
Centurion with etcd Proof-of-Concept

Services Layout

The following code run from inside a Ruby script that has loaded the etcd gem would create the necessary keys to deploy using the above code.

client.set('/services/fooservice/ports/3021', value: 9292)
client.set('/services/fooservice/env/TESTING_URL', value: 'http//foo.example.com/asdf')
@relistan
relistan / out.txt
Created June 23, 2014 22:25
Validating Centurion
kmatthias-mbp:dockercon kmatthias$ bundle exec centurion -p test -e production -a deploy
** Invoke environment:production (first_time)
** Invoke environment:common (first_time)
** Execute environment:common
** Execute environment:production
** Invoke deploy (first_time)
** Execute deploy
** Invoke deploy:get_image (first_time)
** Execute deploy:get_image
** Invoke deploy:pull_image (first_time)
@relistan
relistan / nitro_logback.lua
Created January 30, 2016 00:01
Logback standard output parser for Heka
-- A Heka Decoder for a semi-standard logback entry
local os = require("os")
local lpeg = require("lpeg")
local dash = lpeg.P("-")
local colon = lpeg.P(":")
local space = lpeg.S(" \t")
local eol = lpeg.P(-1)
@relistan
relistan / kafkamon.scala
Created March 14, 2016 22:50
Kafka Offset Monitor
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@relistan
relistan / logback_test.java
Created April 29, 2016 12:39
logback_test.java
package hello;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MyApp1 {
final static Logger logger = LoggerFactory.getLogger(MyApp1.class);
private static void setDefaultUncaughtExceptionHandler() {
try {
@relistan
relistan / blockingreader.go
Last active September 7, 2021 02:56
block-docker-container
package main
import (
"fmt"
"io"
"os"
"github.com/fsouza/go-dockerclient"
)
@relistan
relistan / postgres_queries_and_commands.sql
Created November 22, 2016 14:54 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'