Skip to content

Instantly share code, notes, and snippets.

View ahgittin's full-sized avatar

Alex Heneveld ahgittin

View GitHub Profile
@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";
@ahgittin
ahgittin / jsonball.rb
Created February 23, 2012 21:57
a jekyll tag to parse json files and objects for use as maps subsequently
require 'json'
# JSON parser tag, creating map for use in jekyll markdown
# Alex.Heneveld @ Cloudsoft Corp (remove spaces and add the .com)
# Released under APL 2.0
# usage: {% jsonball varname from TYPE PARAM %}
#
# where TYPE is one of {data,var,file,page}, described below
@ahgittin
ahgittin / mvnf
Created March 29, 2012 18:40
"maven-fast" script to run maven across multiple directories easily: `mvnf -h` for help
#!/bin/bash
export DIRS=""
export ARGS="-o clean install -DskipTests"
if [[ -z $1 || $1 = "-h" || $1 == "--help" ]] ; then
echo
echo "MVNF: a simple script for building multiple maven directories"
echo
echo "usage: mvnf [ -x \"install -Dxxx\" ] dir1 [ dir2 [ ... ]]"
echo
echo "This will do a maven build in each directory specified, in order, "
@ahgittin
ahgittin / gist:2405337
Created April 17, 2012 11:14
brooklyn rest xml sample 1
<app name="MyWebCluster">
<entity type="ControlledDynamicWebAppCluster" name="web">
<config name="war" value="classpath://hello-world-webapp.war"/>
<config name="httpPort" value="8080+"/>
<config name="jvmOpts" type="map">
<field name="brooklyn.example.db.url">
<source entity="mysql" sensor="url"/>
</field>
</config>
<policy type="Resizer">
@ahgittin
ahgittin / gist:2405339
Created April 17, 2012 11:15
brooklyn rest json sample 1
{ "app": {
"name": "MyWebCluster",
"entities": [
{ "name": "web",
"type": "ControlledDynamicWebAppCluster",
"config": {
"war": "classpath://hello-world-webapp.war",
"httpPort": "8080+",
"jvmOpts": {
"brooklyn.example.db.url": { "source": { "entity": "mysql", "sensor": "url" } }
@ahgittin
ahgittin / java test
Created April 25, 2012 12:10
jclouds hang bug
@Test
public void createVm() {
String groupId = "mygroup-"+System.getProperty("user.name")+"-"+UUID.randomUUID().toString();
Properties properties = new Properties();
properties.setProperty(Constants.PROPERTY_PROVIDER, "aws-ec2");
properties.setProperty(Constants.PROPERTY_IDENTITY, identity);
properties.setProperty(Constants.PROPERTY_CREDENTIAL, credential);
properties.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, Boolean.toString(true));
properties.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, Boolean.toString(true));
@ahgittin
ahgittin / thoughts.md
Created May 21, 2012 16:56
Gluecon setup

USB stick

  • maven repo
  • brooklyn repository (jboss, etc)
  • git projects (anonymous http, with history; and showing URL - jclouds-examples, brooklyn, whirr)
  • binaries
  • whirr
  • brooklyn
  • this doc
@ahgittin
ahgittin / _notes.md
Created May 23, 2012 07:36
Inside the DevOps Toolshed

GLUECON CLOUDSOFT WORKSHOP SETUP

IF THE GODS OF WEB ARE SMILING

The preferred installation is when you have good internet links:

  • Fork, clone, and/or download from github.com
@ahgittin
ahgittin / gist:2949025
Created June 18, 2012 15:48
hpcloud and openstack testing
new ComputeServiceContextFactory().createContext("hpcloud-compute",
keyId, credential). getComputeService(). listNodes();
gives:
ERROR java.util.NoSuchElementException:
apiType compute not found in catalog [{type=identity, name=Identity, endpoints=[{versionId=2.0, region=region-a.geo-1, publicURL=https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/, internalURL=null, adminURL=null, tenantId=null, versionInfo=https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/, versionList=https://region-a.geo-1.identity.hpcloudsvc.com:35357}]}]