Skip to content

Instantly share code, notes, and snippets.

View ahgittin's full-sized avatar

Alex Heneveld ahgittin

View GitHub Profile
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
@ahgittin
ahgittin / retrieve-ec2-instance-types.sh
Last active November 13, 2019 10:50 — forked from nmagee/retrieve-ec2-instance-types.sh
Query the AWS Pricing API to get all currently available EC2 instance types
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 / bucket.tf
Last active November 15, 2019 23:57
provider "aws" {
region = "eu-central-1"
}
resource "aws_s3_bucket" "bucket1" {
bucket = "alex-example1-bucket1"
acl = "private"
}
resource "aws_s3_bucket" "bucket2" {
@ahgittin
ahgittin / 1-get-amp-running-tomcat.yaml
Last active July 21, 2020 13:11
Cloudsoft AMP Training examples
name: My Tomcat Server
location: my-first-location
services:
- type: 'TomcatServer'
brooklyn.config:
wars.root: >-
http://bit.ly/2dcaKIV
---
- name: sample
hosts: localhost
tasks:
- name: create a directory to show ansible is working
file:
path: /tmp/created-by-ansible