Skip to content

Instantly share code, notes, and snippets.

View ahgittin's full-sized avatar

Alex Heneveld ahgittin

View GitHub Profile
@ahgittin
ahgittin / gist:8736763
Created January 31, 2014 17:14
dse-cassandra-blueprint.yaml
name: dse-cassandra
# starts a single datacenter DSE cluster and an opscenter node
services:
- type: io.cloudsoft.datastax.dse.DSECassandraDatacenter
name: DSE Cluster
brooklyn.config:
cluster.initial.size: 5
cluster.initial.quorumSize: 3
datastax.cassandra.opscenter.entity: $brooklyn:component("opscenter")
@ahgittin
ahgittin / gist:9934210
Created April 2, 2014 13:33
brooklyn 070-snapshot oome info
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--
<html><body>
<h1>Hello World</h1>
<p>
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.
</p>
<p>
Management policies can then be mixed in.
@ahgittin
ahgittin / SampleMonitorEntity.java
Last active August 29, 2015 14:07
SampleMonitorEntity
package io.cloudsoft.ibm.mms.amp.util;
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
ahgittin / gist:ef8a4b39695f6d4c684e
Created April 23, 2015 09:14
illustration of correct indentation for Apache Brooklyn `provisioning.properties` and how to specify those properties on the location
name: chef-mysql-sample
location:
jclouds:aws-ec2:us-west-1:
minRam: 4gb
services:
- type: chef:mysql
...
provisioning.properties:
# this will override `minRam` set above
minRam: 5046mb
brooklyn.catalog:
version: 0.1
description: Sample VM with a demo script
name: Alex-AWS-VM-1
location:
jclouds:aws-ec2:
region: eu-west-1
osFamily: ubuntu
@ahgittin
ahgittin / https call
Last active August 29, 2015 14:22
Brooklyn GUI groovy snippets
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()
.uri(urlBase)
.credentials(new org.apache.http.auth.UsernamePasswordCredentials(
"admin", password)).build();
brooklyn.util.http.HttpToolResponse r = brooklyn.util.http.HttpTool.httpGet(c, java.net.URI.create(
urlBase+subUrl), null);
@ahgittin
ahgittin / test
Created September 16, 2015 11:35
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
ahgittin / gist:1314030
Created October 25, 2011 19:53
whirr-49 options for cluster controller
 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
ahgittin / gist:1445672
Created December 8, 2011 01:27
reflective equals timing test
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";