Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Heneveld ahgittin

View GitHub Profile
View playbook1.yaml
---
- name: sample
hosts: localhost
tasks:
- name: create a directory to show ansible is working
file:
path: /tmp/created-by-ansible
@ahgittin
ahgittin / jsonball.rb
Created Feb 23, 2012
a jekyll tag to parse json files and objects for use as maps subsequently
View jsonball.rb
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 / 1-get-amp-running-tomcat.yaml
Last active Jul 21, 2020
Cloudsoft AMP Training examples
View 1-get-amp-running-tomcat.yaml
name: My Tomcat Server
location: my-first-location
services:
- type: 'TomcatServer'
brooklyn.config:
wars.root: >-
http://bit.ly/2dcaKIV
View bucket.tf
provider "aws" {
region = "eu-central-1"
}
resource "aws_s3_bucket" "bucket1" {
bucket = "alex-example1-bucket1"
acl = "private"
}
resource "aws_s3_bucket" "bucket2" {
@ahgittin
ahgittin / retrieve-ec2-instance-types.sh
Last active Nov 13, 2019 — forked from nmagee/retrieve-ec2-instance-types.sh
Query the AWS Pricing API to get all currently available EC2 instance types
View retrieve-ec2-instance-types.sh
curl https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/index.json > 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
@ahgittin
ahgittin / jstack-active
Created Sep 16, 2012
script to run jstack but just show those threads which are active ... a poor man's profiler, or how to make eclipse beach ball slightly more exciting :)
View jstack-active
#!/bin/bash
jstack $@ | awk '
function onTraceBegin() {
onTraceEnd()
data["lineCount"]=0
data["head"]=$0
}
function onTraceEnd() {
if ("head" in data) {
View brooklyn-scan-dangling-refs.sh
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
View git-summary.sh
# 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 ("??")
THIS_COMMAND="$0 $@"
while true; do
case $1 in
-o|--offline)
OFFLINE=true
@ahgittin
ahgittin / 1 vitaminder (based on mine, gil's, derek's, then mine again)
Last active Dec 18, 2015
CAMP PDP sketching after v4 and before the fruits
View 1 vitaminder (based on mine, gil's, derek's, then mine again)
name: VitaMinder
artifacts:
-
name: VitaMinder WAR
type: com.example.java:WAR
content: { href: vitaminder.war }
requirements:
-
type: HostedOn
fulfillment: id:as
@ahgittin
ahgittin / jetty-spring.xml
Created Jun 13, 2013
Additional lines to insert into OpenGamma jetty-spring.xml to enable the Jetty MX bean. http://forums.opengamma.com/forum/discussion/comment/743
View jetty-spring.xml
<bean id="standardMBeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
<property name="locateExistingServerIfPossible" value="true" />
</bean>
<bean id="jettyJMXExporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="beans">
<map>
<entry key="com.opengamma.jetty:service=HttpConnector" value-ref="connector" />
<entry key="com.opengamma.jetty:service=HttpServer" value-ref="server" />
</map>