Skip to content

Instantly share code, notes, and snippets.

Alex Heneveld ahgittin

Block or report user

Report or block ahgittin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
provider "aws" {
region = "eu-central-1"
resource "aws_s3_bucket" "bucket1" {
bucket = "alex-example1-bucket1"
acl = "private"
resource "aws_s3_bucket" "bucket2" {
ahgittin /
Last active Nov 13, 2019 — forked from nmagee/
Query the AWS Pricing API to get all currently available EC2 instance types
curl > ec2-pricing.json
cat ec2-pricing.json | jq -r '.products[].attributes["instanceType"]' | sort -u | grep '\.' > instances
cat ec2-pricing.json | jq -c '[.products[].attributes] | [ .[] | select(.instanceType) | select(.location) | {location,instanceType} ] | group_by(.location) | [{ (.[][0].location): [ .[][].instanceType ] | unique }] | sort' > instance-by-region.json
cat instance-by-region.json | jq -r '[ .[] | to_entries | { (.[].key): .[].value | join(", ") } ] > instances-string-by-region.json
for l in locations/* ; do
ENT=`xmlstarlet sel -t -v "location/locationConfig/callerContext/entityProxy" $l`
if [ ! -z "$ENT" ] ; then
if [ -z `find . -name $ENT` ] ; then
# it's a leak
LOC=`basename $l`
echo "Detected location $LOC has reference to deleted entity $ENT - removing it"
rm $l
FILES=`grep -l $LOC locations/*`
if [ ! -z "$FILES" ] ; then
# displays a summary list of commits in your current repo vs upstream branch and upstream master,
# and of working tree changes Added, Modified, Deleted, or not in index ("??")
while true; do
case $1 in
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 / https call
Last active Aug 29, 2015
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);
version: 0.1
description: Sample VM with a demo script
name: Alex-AWS-VM-1
region: eu-west-1
osFamily: ubuntu
ahgittin / gist:ef8a4b39695f6d4c684e
Created Apr 23, 2015
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
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;
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.
You can’t perform that action at this time.