Skip to content

Instantly share code, notes, and snippets.

Max Manders maxmanders

Block or report user

Report or block maxmanders

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@maxmanders
maxmanders / tf_0_main.tf
Last active Jun 18, 2019
Terraform Issue | Conditionally Using New Resource
View tf_0_main.tf
locals {
project = "tfternarywtf"
chosen_sg = "${var.security_groups}"
}
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
View commands.py
def remove(emails, infile):
try
if emails and infile:
raise ValueError('Specify one or more emails, or a file path, but not both')
pass
except ValueError as e:
print(e)
sys.exit(1)
if emails:
@maxmanders
maxmanders / example.py
Created Oct 6, 2017
Apply multiple filters with arguments to a list
View example.py
def filter_list(*args):
filters = list(args)
stuff = #some Boto3 call with a list of dictionaries
filtered = (s for s in stuff['Foo']
if all([f(s) for f in filters]))
return filtered
View out.sh
max at maxmanders-laptop in ~/dev/dotfiles (master)
$ cat test.sh
#!/bin/bash
set -e
set -o pipefail
ZSH=$(which zsh)
BASH=$(which bash)
ERRORS=()
@maxmanders
maxmanders / shellcheck.sh
Created Sep 24, 2017
Bash compatible Zsh And Shellcheck
View shellcheck.sh
ZSH=$(which zsh)
BASH=$(which bash)
shellcheck <(sed "s|#\!${ZSH}|#\!${BASH}|g" < .zshrc.d/functions.zshrc)
@maxmanders
maxmanders / kms_example.sh
Created Apr 13, 2017
KMS Envelope Encryption Using OpenSSL And AWS CLI
View kms_example.sh
$ echo "secret" > secret.txt
$ key_material=$(aws kms generate-data-key --key-id <CMK_key_id> --key-spec AES_256)
$ echo ${key_material} | jq ".CiphertextBlob" | sed 's/"//g' | base64 -d > key.enc
$ export key=$(echo ${key_material} | jq ".Plaintext" | sed 's/"//g' | base64 -d)
$ openssl enc -aes-256-cbc -pass env:key -in secret.txt -out secret.txt.enc
$ rm secret.txt
$ ls
key.enc secret.txt.enc
$ key=$(aws-fd-full kms decrypt --ciphertext-blob fileb://key.enc --output text --query Plaintext | base64 -d)
$ openssl enc -d -aes-256-cbc -pass env:key -in secret.txt.enc -out secret.txt
View keybase.md

Keybase proof

I hereby claim:

  • I am maxmanders on github.
  • I am maxmanders (https://keybase.io/maxmanders) on keybase.
  • I have a public key whose fingerprint is 4D42 A117 3318 1A17 0A98 DDFA 7D04 E21E 3610 854A

To claim this, I am signing this object:

View gist:7ca7ba6392610861d41d
╰─$ bundle exec bin/examples sqs
Commands:
examples s_q_s help [COMMAND] # Describe subcommands or one specific subcommand
examples s_q_s receive # Receive a message from a test SQS queue
examples s_q_s send {message} # Send {message} to a test SQS queue
View gist:7fd0e9b3a2a77996f28e
---
driver:
name: vagrant
customize:
memsize: 2048
numvcpus: 2
provisioner:
name: chef_zero
View app.rb
def bin_files
@cookbook.manifest[:files].collect{|file| file[:path].split("/")[2..-1].join("/") if file[:path] =~ /apps\/#{Regexp.quote(new_resource.name)}\/[^.]/}.compact || []
end
You can’t perform that action at this time.