Skip to content

Instantly share code, notes, and snippets.

View srkiNZ84's full-sized avatar

Srđan (Serge) Đukić srkiNZ84

View GitHub Profile
@srkiNZ84
srkiNZ84 / book.yml
Last active August 10, 2018 10:24
Simple Swagger API definition
swagger: "2.0"
info:
description: "This is a super simple swagger sample Book server"
version: "1.0.0"
title: "Swagger bookserver"
termsOfService: "http://google.com/"
contact:
email: "[email protected]"
license:
name: "Apache 2.0"
@srkiNZ84
srkiNZ84 / geolocation.html
Created September 1, 2018 05:03
Simple Geolocation HTML example
<html>
<head>
<title>Geolocation</title>
</head>
<body>
<script>
if ("geolocation" in navigator){
console.log("Geolocation available");
navigator.geolocation.getCurrentPosition(success, error);
}
#!/bin/bash
declare -a ENVS_TO_PLAN=(test sandbox production)
for i in "${ENVS_TO_PLAN[@]}"; do
echo Planning environment: $i
cd $i
ls -al
echo Running Init for $i environment
aws-vault exec ident -- terraform init
@srkiNZ84
srkiNZ84 / add_access_keys.sh
Created December 11, 2018 03:51
Script to generate and upload access keys to BitBucket repositories
#!/bin/bash
BB_ACCOUNT_NAME="john"
BB_USERNAME="doe"
BB_PASSWORD="password"
declare -a repositoryList=( "limerick-generator" )
for repository in "${repositoryList[@]}"
do
@srkiNZ84
srkiNZ84 / comma_separated_list_to_array.sh
Created January 7, 2019 03:35
comma_separated_list_to_array.sh
#!/bin/bash
CITIES="Paris, Madrid, Berlin"
IFS=', ' read -r -a citiesArray <<< "$CITIES"
for city in "${citiesArray[@]}"
do
echo "City: $city"
done
@srkiNZ84
srkiNZ84 / update_hooks.sh
Created January 13, 2019 22:57
Bash script to update BitBucket webhooks
#!/bin/bash
BB_ACCOUNT_NAME="robot_org"
BB_USERNAME="cleveron"
BB_PASSWORD="password"
NEW_REPO_HOOK_ID="a1b2c3d4e5f6"
declare -a repositoryList=( "package_manifest" )
@srkiNZ84
srkiNZ84 / activemq_dlq.groovy
Last active June 20, 2019 23:23
Groovy script to connect to an ActiveMQ server and receive messages from the default Dead Letter Queue
#!/bin/groovy
// NOTE: The jar "activemq-all-5.15.8.jar" needs to be put under $HOME/.groovy/lib
// for this script to work
import javax.jms.*
import org.apache.activemq.*
def amqURL = "failover:tcp://localhost:61616"
println "Connecting to ActiveMQ at URL " + amqURL
@srkiNZ84
srkiNZ84 / test-xhr.html
Created February 19, 2019 00:47
Simple example of how to use XHR to call and enpoint
<html>
<head>
<title>Testing XHR</title>
</head>
<body>
<p>This is a test</p>
<br />
<div id="foobar"></div>
<script>
// Create the HTTP request
@srkiNZ84
srkiNZ84 / blog.yml
Created April 4, 2019 10:18
Blog API Swagger definition
swagger: "2.0"
info:
description: "This is a blog API defined in swagger"
version: "1.0.0"
title: "Swagger blog API"
termsOfService: "http://blog.dukic.co.nz/terms"
contact:
email: "[email protected]"
license:
name: "AGPL 3.0"
@srkiNZ84
srkiNZ84 / pyenhance_yaml.py
Last active August 8, 2019 11:11
Python script to take OpenAPI YAML definitions and enhance them with AWS API Gateway annotations with a view to auto-generating mocks
#!/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
####!/usr/bin/python3
import os
import yaml
class APIGW():
def __init__(self, responses, passThroughBehavior, requestTemplates,
gwType):