Skip to content

Instantly share code, notes, and snippets.

View chriswhitcombe's full-sized avatar

Chris Whitcombe chriswhitcombe

View GitHub Profile
func testImplicitAuth() {
conf := &oauth2.Config{
ClientID: "clientid",
RedirectURL: "https://server.com",
Endpoint: oauth2.Endpoint{
TokenURL: "http://test.com/auth/token",
AuthURL: "http://test.com/auth/authorize",
},
}
@chriswhitcombe
chriswhitcombe / main.go
Last active August 14, 2020 04:38
Implementing a graceful shutdown of http that is docker compatible
package main
import (
"fmt"
"io"
"net/http"
"os"
"os/signal"
"syscall"
"time"
{
"kind":"Service",
"apiVersion":"v1",
"metadata":{
"name":"goapp-service"
},
"spec":{
"ports": [
{
"port":80,
{
"kind":"ReplicationController",
"apiVersion":"v1",
"id":"goapp",
"metadata":{
"name":"goapp-controller"
},
"spec":{
"replicas":3,
"selector":{
@chriswhitcombe
chriswhitcombe / gist:00d94c106f06d230cb2d
Created June 25, 2015 20:35
Secure client in go (TLS Mutual Auth)
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"log"
"net/http"
)
@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"
)
package main
import (
"fmt"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
Fetch(url string) (body string, urls []string, err error)
@chriswhitcombe
chriswhitcombe / Configurer
Created September 10, 2013 15:07
Sample code to load archaius properties statically via spring
public class ArchaiusPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {
@Override
protected String resolvePlaceholder(String placeholder, Properties props, int systemPropertiesMode) {
return DynamicPropertyFactory.getInstance().getStringProperty(placeholder, "null").get();
}
}
@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: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