This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DOCKER_MIRROR_HOST=$(/sbin/ip route | awk '/default/ { print $3 }') | |
DOCKER_MIRROR_PORT=${MIRROR_PORT:-9001} | |
DOCKER_MIRROR="http://$DOCKER_MIRROR_HOST:$DOCKER_MIRROR_PORT" | |
# HOSTNAME is the Docker container ID, docker initializes this variable to the container ID | |
# APP_PORT is the container Port | |
export HOST_IP=$(curl $DOCKER_MIRROR/hostip) | |
export HOST_PORT=$(curl $DOCKER_MIRROR/container/$HOSTNAME/port/$APP_PORT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dockerBaseImage := "loyaltyone/dakka:0.5" | |
dockerEntrypoint := "/usr/local/bin/bootstrap" +: dockerEntrypoint.value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"TaskDefinition": { | |
"Type": "AWS::ECS::TaskDefinition", | |
"Properties": { | |
"ContainerDefinitions": [{ | |
"Name": "theatre-example", | |
"Image": "loyaltyone/theatre-example:latest", | |
"PortMappings": [{ | |
"ContainerPort": 8080, | |
"HostPort": 0 | |
}, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Service": { | |
"Type": "AWS::ECS::Service", | |
"Properties": { | |
"ServiceName": "theatre-service", | |
"TaskDefinition": { | |
"Ref": "TaskDefinition" | |
}, | |
"DesiredCount": 3, | |
"LoadBalancers": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Stage { | |
/** | |
* A source which feeds an initial batch into a provided flow and emits when entire batch is completed while retrying | |
* unprocessed elements with a backoff strategy. | |
* | |
* The provided flow must accept a set of elements and emit a subset containing unprocessed items or an empty set if | |
* all elements are processed successfully | |
* | |
* @param flow a flow which processes sets at a time and emits corresponding sets containing unprocessed items (if any) | |
* @param minBackoff min time to back off when retrying unprocessed elements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val mavenResolver = sys.env.get("TOKEN").map(token => Seq("repo" at s"https://repourl/maven2")) | |
resolvers ++= mavenResolver.getOrElse(Seq.empty[Resolver]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o pipefail | |
set -o nounset # fail on unset var usage | |
set -o errexit # exit on command failure | |
err_report() { | |
echo "Exited with error on line $1" | |
} | |
# prints errors out along with line number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "local_file" "kube_config" { | |
content = "${var.kube_config}" | |
filename = "${path.module}/kubeconfig" | |
} | |
# Hacky way to force a dependency on some external resource (since modules dont support a depends_on) | |
data "template_file" "deps" { | |
template = "${join(",", var.depends_on)}" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Goal: Be able to do a curl from local to server in AWS private subnet | |
// Host - The machine running the server in a private subnet | |
// Bastion - A machine which has access to the Host in the private subnet. You need to have SSH access to this machine | |
// Local - Your local machine | |
// Normally, if you SSH into your Bastion, you are able to curl the DNS/IP of the private Host machine running your server | |
// To be able to curl from your local machine, you'll need to set up a tunnel between your local and the bastion | |
// When you tunnel, you have to provide the DNS/IP of the private Host as seen from the Bastion. This will typically be a private IP | |
// an internal DNS name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//exercise 1 | |
function toLeet(input) { | |
let leet = { | |
a: "4", | |
A: "4", | |
e: "3", | |
E: "3", | |
i: "1", | |
I: "1", |
OlderNewer