Skip to content

Instantly share code, notes, and snippets.

@shiftie
shiftie / combinePolicies.tf
Last active November 17, 2020 10:26
Terraform IAM policies combine
locals {
policies = [
# policies to combine in JSON
# might be:
# - data.aws_iam_policy.some-policy.policy
# - aws_iam_policy.some-policy.policy
# - file("some-policy.json")
# - templatefile("some-policy.json.tpl", {})
# - aws_iam_policy_document.some-policy.json
aws_iam_policy.policy1.policy,
/**
* To be used with Papertrail provided logs: https://papertrailapp.com/account/archives
* Rename the uncompressed file "papertrail.tsv" (or use "input" argument)
* usage exmaples:
* time node getSlowRequests.js minDuration=5000 > tmp.log && code tmp.log // will parse papertrail.tsv for requests slower than 5s & output to tmp.log & open it in VScode
* time node getSlowRequests.js groupBy=status orderBy=time direction=asc // will group by status code & order (ascedant) by time within each group
*/
'use strict';
@shiftie
shiftie / debugLevels.js
Last active October 12, 2018 10:24
Visionmedia/Debug Logging Levels
/**
* Creates debug instances for different logging levels within your namespace &
* exposes functions to use them
* Usage:
* @example
* const debug = require('./debugLevels')('unicorn');
* debug.info('Hello %s', 'world'); // unicorn:info Hello world +0ms
* debug.error('Oops %O', new Error('damn')); // unicorn:error Oops Error: damn
* // unicorn:error at Object.<anonymous> (....)
*
@shiftie
shiftie / Dockerfile
Created July 2, 2018 13:27 — forked from yefim/Dockerrun.aws.json
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
# Example Dockerfile
FROM hello-world
@shiftie
shiftie / speedTest.js
Last active October 20, 2017 13:19
Page load benchmark
/**
* In one terminal:
* alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
* chrome --remote-debugging-port=9222 --headless
* In another terminal:
* nvm use 7.6.0
* yarn add chrome-har-capturer
* node speedTest.js
* Wait for command to complete (depends on amount of URLs & iterations)
*/
@shiftie
shiftie / keybase.md
Created February 14, 2017 11:01
key

Keybase proof

I hereby claim:

  • I am shiftie on github.
  • I am gordan (https://keybase.io/gordan) on keybase.
  • I have a public key whose fingerprint is A385 2BD0 F6DB 5BF0 4DD1 4A60 8AB3 366E C125 9EE4

To claim this, I am signing this object: