Skip to content

Instantly share code, notes, and snippets.

View chriswhitcombe's full-sized avatar

Chris Whitcombe chriswhitcombe

View GitHub Profile
{
"kind":"ReplicationController",
"apiVersion":"v1",
"id":"goapp",
"metadata":{
"name":"goapp-controller"
},
"spec":{
"replicas":3,
"selector":{
{
"kind":"Service",
"apiVersion":"v1",
"metadata":{
"name":"goapp-service"
},
"spec":{
"ports": [
{
"port":80,
@chriswhitcombe
chriswhitcombe / gist:1490692
Created December 17, 2011 16:48
OSGi Declarative Services Impl
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="Reporting Service">
<implementation class="com.chriswhitcombe.reporting.impl.ReportingServiceImpl"/>
<service>
<provide interface="com.chriswhitcombe.reporting.ReportingService"/>
</service>
</scr:component>
@chriswhitcombe
chriswhitcombe / gist:1490724
Created December 17, 2011 16:56
dOSGI Service
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="Reporting Service">
<implementation class="com.chriswhitcombe.reporting.impl.ReportingServiceImpl"/>
<property name="service.exported.interfaces" value="*" />
<property name="service.exported.configs" value="org.apache.cxf.ws" />
<property name="org.apache.cxf.ws.address" value="http://localhost:9000/reporting" />
<service>
<provide interface="com.chriswhitcombe.reporting.ReportingService"/>
</service>
@chriswhitcombe
chriswhitcombe / gist:1490739
Created December 17, 2011 17:03
DS Remote services wiring
<?xml version="1.0" encoding="UTF-8"?>
<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0">
<endpoint-description>
<property name="objectClass">
<array>
<value>com.chriswhitcombe.reporting.ReportingService</value>
</array>
</property>
<property name="endpoint.id">http://localhost:9000/reporting</property>
<property name="service.imported.configs">org.apache.cxf.ws</property>
@chriswhitcombe
chriswhitcombe / gist:1561725
Created January 4, 2012 19:53
send a message to graphite over UDP
// get a datagram socket
DatagramSocket udpSocket = new DatagramSocket();
// send request
byte[] buf = msg.getBytes();
InetAddress address = InetAddress.getByName(graphiteHost);
System.out.println(address);
DatagramPacket packet = new DatagramPacket(buf, buf.length, address, graphitePort);
udpSocket.send(packet);
udpSocket.close();
@chriswhitcombe
chriswhitcombe / gist:1675921
Created January 25, 2012 11:47
PHP to show how they attach your mobile number in http headers
<?php
foreach($_SERVER as $header => $value){
if(ereg('HTTP_(.+)',$header,$hp)){
echo "<li>$header = $value</li>";
}
}
?>
@chriswhitcombe
chriswhitcombe / gist:2713634
Last active October 4, 2015 23:07
Setting up a storm cluster
#install gcc
yum install gcc
#install C++ extensions
yum install gcc-c++.x86_64
#install uuid dev (may not be needed)
#yum install uuid-devel.x86_64
#install libuuid
@chriswhitcombe
chriswhitcombe / gist:5512489
Last active December 16, 2015 23:09
Installing tomcat6 on centos 6.3
#make sure were up to date
yum update -y
#install java 7
yum install -y java-1.7.0-openjdk.x86_64
#install tomcat 6
yum install -y tomcat6 tomcat6-admin-webapps tomcat6-webapps
#edit the users file to allow admin
@chriswhitcombe
chriswhitcombe / gist:2e0450294f370f493aec
Created June 25, 2015 20:33
Secure server in go (TLS Mutual Auth)
package main
import (
"crypto/tls"
"crypto/x509"
"io"
"io/ioutil"
"log"
"net/http"
)