Skip to content

Instantly share code, notes, and snippets.

View relistan's full-sized avatar

Karl Matthias relistan

View GitHub Profile
@relistan
relistan / ssh-config
Created March 22, 2012 16:36
proxy ssh through a jump host without breaking all other ssh connections
Host *
ForwardAgent yes
ProxyCommand ~/bin/ssh-proxy.sh %h %p username@jump-host
ServerAliveInterval 10
ServerAliveCountMax 600
@relistan
relistan / Dockerfile
Created December 5, 2017 14:03
Sidecar Envoy Docker container
FROM envoyproxy/envoy:v1.5.0
RUN apt-get update
COPY envoy.yaml /etc/envoy.yaml
ADD run.sh /run.sh
CMD /run.sh
@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%'
@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 / 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 / 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 / upstart_completion.sh
Created November 14, 2013 17:31
Upstart bash auto-completion that works on RHEL/CentOS with older versions of Upstart.
# bash-completion for the upstart event-based init replacement
# (http://upstart.ubuntu.com / https://launchpad.net/upstart)
#
# We don't provide completion for 'init' itself for obvious reasons.
# Original is from: https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/672067/+attachment/1765103/+files/upstart.sh
_upstart_conf_events()
{
initctl list|awk '{print $1}'
@relistan
relistan / memtest
Created November 7, 2013 23:21
Machine burn-in script
#!/bin/bash
#
# memtest
#
# A general purpose memory tester script, with options for enabling extra
# simultaneous tests in an attempt to test the capacity of the power supply
# in the machine. You can find the original source of this script and
# additional documentation on its usage by visiting my work web page at
# http://people.redhat.com/~dledford/
#
@relistan
relistan / mydrive.rb
Created September 3, 2013 19:31
RTanque bot for SRUG code night
class Mydrive < RTanque::Bot::Brain
NAME = 'mydrive'
include RTanque::Bot::BrainHelper
CORNERS = [:NW, :NE, :SE, :SW]
TURRET_FIRE_RANGE = RTanque::Heading::ONE_DEGREE * 1.0
def tick!
self.hide_in_corners
if (target = self.acquire_target)
@relistan
relistan / histo.rb
Last active December 14, 2015 04:29
Draw a histogram from a CSV on the command line
#!/usr/bin/env ruby
COLUMNS_TO_USE = 40.0
histo = []
0.upto(9) { |i| histo[i] = 0 }
field_to_parse = ARGV.shift.to_i
ARGF.each do |line|
fields = line.split(/,/)