Skip to content

Instantly share code, notes, and snippets.

View ahgittin's full-sized avatar

Alex Heneveld ahgittin

View GitHub Profile
ahgittin / gist:8736763
Created January 31, 2014 17:14
View gist:8736763
name: dse-cassandra
# starts a single datacenter DSE cluster and an opscenter node
- type: io.cloudsoft.datastax.dse.DSECassandraDatacenter
name: DSE Cluster
cluster.initial.size: 5
cluster.initial.quorumSize: 3
datastax.cassandra.opscenter.entity: $brooklyn:component("opscenter")
ahgittin / gist:9934210
Created April 2, 2014 13:33
brooklyn 070-snapshot oome info
View gist:9934210
Hosted AMP in SL running no blueprints currently, but previously deploying OG to SL and AWS
num #instances #bytes class name
1: 5798577 185554464 java.util.concurrent.ConcurrentHashMap$HashEntry
2: 5403795 172921440 java.lang.String
3: 1431659 84584664 [C
4: 1528111 67764056 [Ljava.util.concurrent.ConcurrentHashMap$HashEntry;
5: 1528111 61124440 java.util.concurrent.ConcurrentHashMap$Segment
cat > index.html << --EOF--
<h1>Hello World</h1>
This is a sample Brooklyn-deployed web server, built on netcat.
Of course you can use any script here, or pre-built blueprints for common webapp, nosql, message software,
services, clusters, or a pre-built imageId, or Chef -- up to you.
Management policies can then be mixed in.
ahgittin /
Last active August 29, 2015 14:07
import brooklyn.config.ConfigKey;
import brooklyn.enricher.Enrichers;
import brooklyn.entity.basic.AbstractEntity;
import brooklyn.entity.basic.Attributes;
import brooklyn.entity.basic.ConfigKeys;
import brooklyn.event.AttributeSensor;
import brooklyn.event.basic.Sensors;
import brooklyn.event.feed.http.HttpFeed;
ahgittin / gist:ef8a4b39695f6d4c684e
Created April 23, 2015 09:14
illustration of correct indentation for Apache Brooklyn `` and how to specify those properties on the location
View gist:ef8a4b39695f6d4c684e
name: chef-mysql-sample
minRam: 4gb
- type: chef:mysql
# this will override `minRam` set above
minRam: 5046mb
version: 0.1
description: Sample VM with a demo script
name: Alex-AWS-VM-1
region: eu-west-1
osFamily: ubuntu
ahgittin / https call
Last active August 29, 2015 14:22
Brooklyn GUI groovy snippets
View https call
String urlBase = "https://HOSTNAME:8443";
String subUrl = "/";
String password = "PASSWORD";
org.apache.http.client.HttpClient c = new brooklyn.util.http.HttpTool.HttpClientBuilder().https(true).trustAll()
.credentials(new org.apache.http.auth.UsernamePasswordCredentials(
"admin", password)).build();
brooklyn.util.http.HttpToolResponse r = brooklyn.util.http.HttpTool.httpGet(c,
urlBase+subUrl), null);
ahgittin / test
Created September 16, 2015 11:35
View test
interface Function2 { int apply(int a, int b); }
int factorial(int n) { return applyFromOneToN(new Function2() { int apply(int a, int b) { return a*b; } }, n); }
ahgittin / gist:1314030
Created October 25, 2011 19:53
whirr-49 options for cluster controller
View gist:1314030
 public Map<? extends NodeMetadata, ExecResponse> runScriptOnNodesMatching(ClusterSpec spec,
       Predicate<NodeMetadata> condition, Statement statement) throws IOException, RunScriptOnNodesException {
   return runScriptOnNodesMatching(spec, condition, statement, null);
 public Map<? extends NodeMetadata, ExecResponse> runScriptOnNodesMatching(ClusterSpec spec,
     Predicate<NodeMetadata> condition, Statement statement, RunScriptOptions options)
     throws IOException, RunScriptOnNodesException {
   Credentials credentials = new Credentials(spec.getClusterUser(), spec.getPrivateKey());
   if (options==null)
ahgittin / gist:1445672
Created December 8, 2011 01:27
reflective equals timing test
View gist:1445672
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
public class ReflectiveEquals {
static class Fast {
public int a = 1;
public int b = 2;
public String c = "foo";