Skip to content

Instantly share code, notes, and snippets.

@elblivion
elblivion / kms_example.sh
Created July 29, 2016 13:44
AWS KMS for Chef data bags
$ aws kms encrypt --key-id arn:aws:kms:us-east-1:<my_account>:key/<my_key> --plaintext $(cat ~/.chef/prod-secret) --query CiphertextBlob --output text | base64 -D > secret
$ aws kms decrypt --ciphertext-blob fileb://secret --output text --query Plaintext | base64 -D > decoded
$ if [[ "$(cat decoded)" == "$(cat ~/.chef/prod-secret)" ]]; then echo "got back original chef secret"; fi
got back original chef secret
@elblivion
elblivion / .bash_profile
Last active May 11, 2016 10:06
gpg-agent on OSX
[ -f ~/.gnupg/gpg-agent-info ] && source ~/.gnupg/gpg-agent-info
if [ -S "${GPG_AGENT_INFO%%:*}" ]; then
export GPG_AGENT_INFO
else
eval $( gpg-agent --daemon --options /Users/stanton/.gnupg/gpg-agent.conf --enable-ssh-support --log-file /var/log/gpg-agent.log --write-env-file /Users/stanton/.gnupg/gpg-agent-info )
fi
@elblivion
elblivion / coreos_ami.tf.json
Last active February 28, 2016 14:21
Generate Terraform config for CoreOS AMIs
{
"variable": {
"coreos_stable_amis": {
"default": [
{
"eu-central-1": "ami-f0e8f09c"
},
{
"ap-northeast-1": "ami-a93802c7"
},
@elblivion
elblivion / app.tf
Last active February 16, 2016 20:30
ECS service module
module "myapp" {
source = "modules/myapp_service"
environment = "${var.environment}"
ecs_cluster_id = "${module.ecs_cluster.cluster_id}"
}
@elblivion
elblivion / Makefile
Created February 16, 2016 10:23
terraform-modules/tests/Makefile
default: test
test: plan clean
@echo "Ran plan check"
integration: build destroy
@echo "Ran integration test"
plan:
terraform version
#!/bin/bash
AZ=`ec2metadata | grep ^availability-zone | cut -f 2 -d" "`
REGION=`ec2metadata | grep ^availability-zone | cut -f 2 -d" " | sed 's/.$//'`
INSTANCE=`ec2metadata | grep ^instance-id | cut -f 2 -d" "`
trap "echo \"New instance $INSTANCE failed setup\" | \
/usr/local/bin/gofog sns publish -r ${sns_region} -t ${sns_topic} \
-s \"New instance $INSTANCE failed setup\"" ERR
set -e
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::<our-log-bucket>/cheflogs*"
],
@elblivion
elblivion / gist:d5024c2dacf77b8a09c6
Created February 10, 2016 16:33
Weird CoreOS boot errors
[Herror: syntax error.
error: Incorrect command.
error: syntax error.
error: syntax error.
error: Incorrect command.
error: syntax error.
error: syntax error.
error: Incorrect command.
error: syntax error.
[?25lGNU GRUB version 2.02~beta2
@elblivion
elblivion / gist:010225fdcd69f2d98517
Created February 1, 2016 16:27
NSolid core dump
nsolid-console: ../src/node_zlib.cc:124: static void node::ZCtx::Write(const v8::FunctionCallbackInfo<v8::Value>&) [with bool async = true]: Assertion `(false) == (ctx->pending_close_ && "close is pending")' failed.
Aborted (core dumped)
npm ERR! Linux 3.13.0-74-generic
npm ERR! argv "/home/stanton/nsolid-v1.2.0-linux-x64/bin/nsolid" "/home/stanton/nsolid-v1.2.0-linux-x64/bin/npm" "start"
npm ERR! node v4.2.4
npm ERR! npm v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! nsolid-console@1.4.4 start: `NODE_ENV=production node bin/nsolid-console --interval=1000`
npm ERR! Exit status 134
APAC
----
cache-akl
cache-hkg
cache-itm
cache-mel
cache-nrt
cache-sin
cache-syd
cache-wlg