Skip to content

Instantly share code, notes, and snippets.

@jolexa
jolexa / output.txt
Created August 12, 2020 15:24
terraform-provider-aws issue # <> terraform output
mbp:~/tmp
$ find .
.
./root.tf
./.tool-versions
./internal
./internal/main.tf
mbp:~/tmp
$ terraform init
Initializing modules...
@jolexa
jolexa / microbot.nomad
Created February 5, 2019 20:53
Example Nomad Job file
job "microbot" {
region = "global"
datacenters = ["nomad-intro"]
# Rolling updates
update {
stagger = "10s"
max_parallel = 3
}
@jolexa
jolexa / invalidate-all.py
Created October 24, 2018 14:07
Invalidate CloudFront Cache with boto3
from time import time
import sys
import boto3
client = boto3.client('cloudfront')
# Uncomment this to pass a URL to the script
#def get_id(url):
# print("get_id args: {0}".format(url))
# # url: asdf.cloudfront.net
# # return: E2134123ASDF
@jolexa
jolexa / stdout.txt
Created October 1, 2018 16:56
make test error output
mbp:~/sandbox/atlantis [master u= 1af6c77e]
$ docker run --rm -v $(pwd):/go/src/github.com/runatlantis/atlantis -w /go/src/github.com/runatlantis/atlantis runatlantis/testing-env make test
? github.com/runatlantis/atlantis [no test files]
ok github.com/runatlantis/atlantis/cmd 0.031s
# github.com/runatlantis/atlantis/server/events_test [github.com/runatlantis/atlantis/server/events.test]
server/events/markdown_renderer_test.go:57:18: too many arguments in call to r.Render
have (events.CommandResult, events.CommandName, string, bool, models.VCSHostType)
want (events.CommandResult, events.CommandName, string, bool)
server/events/markdown_renderer_test.go:97:18: too many arguments in call to r.Render
have (events.CommandResult, events.CommandName, string, bool, models.VCSHostType)
@jolexa
jolexa / cloudformation.yml
Last active May 18, 2018 15:07
AWS IAM Role that both services *and* Humans-with-2fa can assume
AWSTemplateFormatVersion: '2010-09-09'
Resources:
ExampleRole:
Type: AWS::IAM::Role
Properties:
Path: "/cfn/"
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
Policies:
- PolicyName: DynamoDBGetter
@jolexa
jolexa / open_aws_iam_url.py
Created March 23, 2017 15:31
Python script to open IAM documentation in new tab
#!/usr/bin/env python
import sys
import webbrowser
service = sys.argv[1]
url = "https://docs.aws.amazon.com/IAM/latest/UserGuide/list_{}.html".format(service)
webbrowser.open(url, new=2)
@jolexa
jolexa / unicreds_example.py
Created January 27, 2017 18:15
Using unicreds in AWS Lambda (python)
from subprocess import Popen, PIPE, STDOUT
import os
region = os.environ['region'] # Pass region in as a Lambda env variable
# Of course this assumes that your lambda has IAM permission to the KMS Key and DDB Table
def getSecret(key):
# unicreds is written in go, it is self-contained so, in your zip file include the package. One implementation of that is:
# curl -sL https://github.com/Versent/unicreds/releases/download/1.5.1/unicreds_1.5.1_linux_amd64.tar.gz | tar zx
cmd = "./unicreds -r {0} get -n {1}".format(region, key)
@jolexa
jolexa / gist:3bfae81b950a24e93e025e8a4632c059
Created September 12, 2016 20:02 — forked from eduardocardoso/gist:82a629882ddb02ab3677
Script to delete exited containers and untagged/unused images from docker
#!/bin/bash
set -o errexit
echo "Removing exited docker containers..."
docker ps -a -f status=exited -q | xargs -r docker rm -v
echo "Removing dangling images..."
docker images --no-trunc -q -f dangling=true | xargs -r docker rmi
@jolexa
jolexa / 2015-lifting-totals.rb
Last active December 28, 2015 02:00
Simple, hacky ruby script to parse csv and provide a number for 2015
#!/usr/bin/ruby
# Tested with ruby-2.0
# 1) Download CSV file with workout data
# 2) run this script as './2015-lifting-totals.rb <path to csv file>
require 'csv'
# Ugly HACK!
@jolexa
jolexa / gist:ee9e152aa7045c558e02
Created November 10, 2015 02:45
mesos socket keepalive
$ git diff
diff --git a/3rdparty/libprocess/include/process/network.hpp b/3rdparty/libprocess/include/process/network.hpp
index 61bfa82..32c14e3 100644
--- a/3rdparty/libprocess/include/process/network.hpp
+++ b/3rdparty/libprocess/include/process/network.hpp
@@ -44,6 +44,10 @@ inline Try<int> socket(int family, int type, int protocol)
return ErrnoError();
}
#endif // __APPLE__
+ const int enable = 1;