Skip to content

Instantly share code, notes, and snippets.

View geoffhendrey's full-sized avatar

Geoffrey Hendrey geoffhendrey

View GitHub Profile
long count = 1;
System.out.println("Waiting for messages...");
while (true) {
Message msg = consumer.receive();
if (msg instanceof TextMessage) {
String body = ((TextMessage) msg).getText();
if ("SHUTDOWN".equals(body)) {
long diff = System.currentTimeMillis() - start;
System.out.println(String.format("Received %d in %.2f seconds", count, (1.0 * diff / 1000.0)));
connection.close();
@geoffhendrey
geoffhendrey / gist:4334b89dd1e1b5e588688a28d9d9f766
Created June 14, 2016 20:54
gradle build --stacktrace --info --debug
ghendrey-mbp:gradletest ghendrey$ gradle build --stacktrace --info --debug
09:33:30.845 [INFO] [org.gradle.BuildLogger] Starting Build
09:33:30.849 [DEBUG] [org.gradle.BuildLogger] Gradle user home: /Users/ghendrey/.gradle
09:33:30.850 [DEBUG] [org.gradle.BuildLogger] Current dir: /Users/ghendrey/NetBeansProjects/gradletest
09:33:30.850 [DEBUG] [org.gradle.BuildLogger] Settings file: null
09:33:30.850 [DEBUG] [org.gradle.BuildLogger] Build file: null
09:33:30.854 [DEBUG] [org.gradle.initialization.buildsrc.BuildSourceBuilder] Starting to build the build sources.
09:33:30.855 [DEBUG] [org.gradle.initialization.buildsrc.BuildSourceBuilder] Gradle source dir does not exist. We leave.
09:33:30.857 [DEBUG] [org.gradle.initialization.DefaultGradlePropertiesLoader] Found env project properties: []
09:33:30.857 [DEBUG] [org.gradle.initialization.DefaultGradlePropertiesLoader] Found system project properties: []
I0615 23:35:16.993402 1 server.go:88] Using http://localhost:8080 for kubernetes master
I0615 23:35:16.993503 1 server.go:89] Using kubernetes API <nil>
I0615 23:35:16.993614 1 server.go:129] Starting SkyDNS server. Listening on port:10053
I0615 23:35:16.993652 1 server.go:136] skydns: metrics enabled on :/metrics
I0615 23:35:16.993664 1 dns.go:139] Waiting for service: default/kubernetes
I0615 23:35:16.994068 1 logs.go:41] skydns: ready for queries on cluster.local. for tcp://0.0.0.0:10053 [rcache 0]
I0615 23:35:16.994156 1 logs.go:41] skydns: ready for queries on cluster.local. for udp://0.0.0.0:10053 [rcache 0]
E0615 23:35:17.045007 1 reflector.go:216] pkg/dns/dns.go:128: Failed to list *api.Service: serializer for text/html; charset=utf-8 doesn't exist
E0615 23:35:17.045291 1 reflector.go:216] pkg/dns/dns.go:127: Failed to list *api.Endpoints: serializer for text/html; charset=utf-8 doesn't exist
I0615 23:35:17.048453 1 dns.go:145] Ignoring error
@geoffhendrey
geoffhendrey / invoke_method.go
Created October 5, 2016 16:51
How to get an actual instance out of a Go/Golang reflect.Value
//Author Geoffrrey Hendrey
//Here we dynamically invoke a method, passing the method the input, whose type we don't know. We know the method returns two things, a value and an errror.
//(multiple return values). This code shows how we grab the error, which
//is the second return value of the method, check it it is not nil, and if not nil type-assert it to an actual error (line 11). They key is
//on line 11 where we extract the interface() from the errReflect, which is reflect.Value. Once we have an interface{} we can do the type-assertion.
func invokeMethod(method reflect.Value, input interface{}) (resp interface{}, err error) {
in := []reflect.Value{reflect.ValueOf(input)}
returnValuesFromClientCall := method.Call(in)
@geoffhendrey
geoffhendrey / gist:8aee84abdf9c3ffccfd1a912b8ffb80a
Last active February 1, 2017 21:05
Subject: [all] Diversity and Openness Make Us Better
Subject: [all] Diversity and Openness Make Us Better
Splunkers,
From its earliest beginnings, Splunk has stood for, and continues to stand for equal opportunity. We enthusiastically embrace different cultures and perspectives and have at our core values and beliefs, respect for all human beings. Diversity is at the very heart of who we are, as a global company comprised of committed and caring people from every corner of the world.
Over the last few days, we have witnessed the confusion, shock, and fear created by President Trump’s issuance of an Executive Order that effectively bans people from several predominantly Muslim countries from entering the United States, irrespective of whether they are contributing members of our society, have put their own lives at risk to aid the United States and its allies, or are fleeing the devastation of war. This order strikes at the very foundation of our democracy.
I wish to assure you that we are doing everything that we can to identify and support those among
> .init -f example/blogexample.yaml
{
"numPages": 1,
"planets": "${[1..numPages].($fetch('https://swapi.dev/api/planets/?page=' & $string($)).json().results)}",
"planetNames": "${planets.name}",
"onSelect": "${function($name){$set('/selectedPlanetName', $name)}}",
"selectedPlanetName": "Tatooine",
"residentsOfSelectedPlanet": "${planets[name=$$.selectedPlanetName].residents.($fetch($).json()).name}"
}
> .from /selectedPlanetName