Skip to content

Instantly share code, notes, and snippets.

@stuart-warren
stuart-warren / tomcat7.spec
Created February 7, 2014 09:56
Tomcat 7.0.50 RPM spec file (used with OpenShift on CentOS 6.5)
View tomcat7.spec
# To Build:
#
# sudo yum -y install rpmdevtools && rpmdev-setuptree
#
# wget https://gist.github.com/stuart-warren/8859980/raw/a6ec61ce0c03c69638fa85dcdb8d1f1a5a559e51/tomcat7.spec -O ~/rpmbuild/SPECS/tomcat7.spec
# wget https://raw.github.com/nmilford/rpm-tomcat7/master/tomcat7.init -O ~/rpmbuild/SOURCES/tomcat7.init
# wget https://raw.github.com/nmilford/rpm-tomcat7/master/tomcat7.sysconfig -O ~/rpmbuild/SOURCES/tomcat7.sysconfig
# wget https://raw.github.com/nmilford/rpm-tomcat7/master/tomcat7.logrotate -O ~/rpmbuild/SOURCES/tomcat7.logrotate
# wget http://mirror.ox.ac.uk/sites/rsync.apache.org/tomcat/tomcat-7/v7.0.50/bin/apache-tomcat-7.0.50.tar.gz -O ~/rpmbuild/SOURCES/apache-tomcat-7.0.50.tar.gz
# rpmbuild -bb ~/rpmbuild/SPECS/tomcat7.spec
@stuart-warren
stuart-warren / registry.service
Last active August 29, 2015 13:56
Attempt to get Docker registry to start on CoreOS
View registry.service
[Unit]
Description=Docker Registry
After=docker.service
Requires=docker.service
[Service]
ExecStart=/usr/bin/docker run -p 5000:5000 registry
View run-individual-tcollector.sh
stuart@LAPTOP:~/Workspace/git/tcollector$ PYTHONPATH=`pwd` python collectors/0/jolokia.py
@stuart-warren
stuart-warren / docker-stdout
Created September 26, 2014 14:02
Docker log to stdout
View docker-stdout
Sometimes you want your container to log to stdout, but the process can only write to a file.
e.g. nginx
Simply create a symlink from the logfile you are writing to, to /proc/self/fd/1 or write directly to it.
Example:
user www-data;
worker_processes 4;
pid /run/nginx.pid;
@stuart-warren
stuart-warren / iso8601-date.sh
Created September 26, 2014 11:13
Output date with bash for use with Logstash
View iso8601-date.sh
# Wanted to output date for use with Logstash
# Using gnu date:
date -u +"%Y-%m-%dT%H:%M:%S.%3N%:z"
# Outputs: 2014-09-26T11:07:05.393+00:00
@stuart-warren
stuart-warren / Dockerfile
Created October 24, 2014 17:40
Build go apps without installing go (needs more testing)
View Dockerfile
FROM ubuntu:latest
## Run with:
# docker build -t golang .
# export GOPATH=/home/user.name/gostuff
# alias go='docker run -ti -v ${GOPATH}:${GOPATH} -e GOPATH=${GOPATH} -w ${PWD} golang'
# alias gofmt='docker run -ti -v ${GOPATH}:${GOPATH} -e GOPATH=${GOPATH} -w ${PWD} --entrypoint=/go/bin/gofmt golang'
# alias godoc='docker run -ti -v ${GOPATH}:${GOPATH} -e GOPATH=${GOPATH} -w ${PWD} --entrypoint=/go/bin/godoc golang'
# cd /project/within/GOPATH
# go get github.com/gin-gonic/gin
@stuart-warren
stuart-warren / Dockerfile
Created October 24, 2014 10:56
Build haproxy with ssl
View Dockerfile
FROM ubuntu:14.04.1
# docker build -t haproxybuild .
# git clone http://git.haproxy.org/git/haproxy-1.5.git
# cd haproxy-1.5
# docker run -ti -v $(pwd):/src haproxybuild
RUN apt-get update && apt-get install -y build-essential libpcre3-dev libssl-dev
VOLUME /src
@stuart-warren
stuart-warren / BufferedTLSTelnetAppender.java
Last active August 29, 2015 14:09
Access recent (and tail new) logs from your Log4j Java app over a TLS connection using ncat
View BufferedTLSTelnetAppender.java
/*
* 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
*
@stuart-warren
stuart-warren / mesos-on-coreos.txt
Last active August 29, 2015 14:10
CoreOS Mesos notes
View mesos-on-coreos.txt
# May need to use a better zookeeper container capable of clustering
# https://github.com/signalfuse/docker-zookeeper ?
docker run -d -p 2181:2181 -p 2888:2888 -p 3888:3888 jplock/zookeeper
# See this for other config values
# http://mesos.apache.org/documentation/latest/configuration/
docker run -d \
@stuart-warren
stuart-warren / es-thrift.go
Created December 7, 2014 22:41
Example golang code to access Elasticsearch using Thrift
View es-thrift.go
package main
/*
* Example golang code to access Elasticsearch using Thrift
* gen-go directory generated with:
* ``thrift -gen go elasticsearch.thrift``
*/
import (
"fmt"
"git.apache.org/thrift.git/lib/go/thrift"
"github.com/stuart-warren/es-thrift/gen-go/elasticsearch" // generated code