This file contains hidden or 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
| // Usage: go run main.go | node decode.js | |
| /* | |
| // main.go: | |
| package main | |
| import ( | |
| "crypto/aes" | |
| "crypto/cipher" |
This file contains hidden or 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 | |
| curl -qL 169.254.170.2/$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI > credentials.json | |
| mkdir -p ~/.aws | |
| echo "[default]" > ~/.aws/credentials | |
| echo "aws_access_key_id = $(cat credentials.json | jq '.AccessKeyId' | sed s'/"//g')" >> ~/.aws/credentials | |
| echo "aws_secret_access_key = $(cat credentials.json | jq '.SecretAccessKey' | sed s'/"//g')" >> ~/.aws/credentials | |
| echo "aws_session_token = $(cat credentials.json | jq '.Token' | sed s'/"//g')" >> ~/.aws/credentials | |
| rm credentials.json |
This file contains hidden or 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
| aws apigateway get-rest-apis > apis.json | |
| rm -rf apis | |
| mkdir apis | |
| jq -r '.items[] | .id' apis.json | while read i; do | |
| aws apigateway get-stages --rest-api-id $i > stages.json | |
| jq -r '.item[] | .stageName' stages.json | while read z; do | |
| aws apigateway get-export --rest-api-id $i --stage-name $z --export-type 'swagger' "apis/$z-$i.json" | |
| done | |
| done |
This file contains hidden or 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
| public class Tuple<L,R> { | |
| private final L left; | |
| private final R right; | |
| public Tuple(L left, R right) { | |
| this.left = left; | |
| this.right = right; | |
| } |
This file contains hidden or 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 "aws_api_gateway_deployment" "api_gw_deployment" { | |
| stage_description = "${md5(file("apigateway.tf"))}" | |
| rest_api_id = "${aws_api_gateway_rest_api.api_gw.id}" | |
| stage_name = "production" | |
| } |
This file contains hidden or 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
| private static class Key { | |
| private final Object key; | |
| private final long timelife; | |
| public Key(Object key, long timeout) { | |
| this.key = key; | |
| this.timelife = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(timeout); | |
| } |