Skip to content

Instantly share code, notes, and snippets.

@weavenet
weavenet / cfn-signal.sh
Last active March 10, 2023 14:49
Bash script to send Cloud Formation signals via curl.
#!/bin/bash
#
# This script will signal the provided Cloud Formation URL with success or failue.
# Result is expected to be the return code of a configuration management script.
# Success will only be signaled if the script returns 0
export result=$1
export url=$2
function help {
@weavenet
weavenet / cfn-signal.sh
Last active December 18, 2015 19:39
Cloud Formation Template and scripts to create AMI via Roark and Heirloom.
#!/bin/bash
#
# This script will signal the provided Cloud Formation URL with success or failue.
# Result is expected to be the return code of a configuration management script.
# Success will only be signaled if the script returns 0
export result=$1
export url=$2
function help {
@weavenet
weavenet / dynamo_sample.rb
Created June 27, 2013 20:44
Dynamo Ruby Sample
#!/usr/bin/env ruby
require 'aws-sdk'
# create a table (10 read and 5 write capacity units)
dynamo_db = AWS::DynamoDB.new :region => 'us-west-2'
# get a table by name and specify its schema
table = dynamo_db.tables['dynamo-test']
table.hash_key = ['Customer ID', :number]
@weavenet
weavenet / gist:6171363
Created August 7, 2013 05:07
Ruby method to stub out ENV variables in Rspec.
module EnvVar
def set_env_var(name, value)
ENV.stub(:[])
ENV.stub(:[]).with(name).and_return(value)
end
end
@weavenet
weavenet / travel
Created October 31, 2013 14:21
In preparation for an international backpacking trip, I updated my travel checklist. Below is a list of things to pack, prepare and keep in mind while traveling.
## Equipment
### Hygiene
* Razor(s)
* Earplugs
* Eye Mask
* Baby Powder
* Chap Stick
* Antacid
@weavenet
weavenet / gist:9787119
Created March 26, 2014 16:20
Find and replace strings across files recursively in a directory on OS X.
find . -type f -name '*.txt' -exec sed -i '' s/123/321/ {} +
@weavenet
weavenet / 1_working.hs
Last active August 29, 2015 14:00
Mixing pure and in-pure functions in Haskell
import Data.Char
data Request = Request { message :: String }
main = getIt
getIt :: IO()
getIt = do
msg <- getLine
let r = Request { message = msg }

Keybase proof

I hereby claim:

  • I am brettweavnet on github.
  • I am brettweavnet (https://keybase.io/brettweavnet) on keybase.
  • I have a public key whose fingerprint is 5976 B551 05D2 E8D2 C86E B49E 35CD F4E7 EB00 0645

To claim this, I am signing this object:

@weavenet
weavenet / storing_sensitive_environment_variables.md
Last active August 5, 2017 13:05
Storing sensitive environment variables

I keep my dot files public, I of course don't want to have my credentials stored in those dotfiles.

To call applications which require credentials to be set as env vars I have the following setup.

Create a file called ~/.run_with_creds with all the secret credentials after an env statement which then calls the input parameters:

env TRELLO_DEVELOPER_PUBLIC_KEY=xxx \
    TRELLO_MEMBER_TOKEN=yyy \
 AWS_ACCESS_KEY_ID=987 \
@weavenet
weavenet / dotfiles.md
Last active August 29, 2015 14:12
Why I Made My Dotfiles Private

Private Dotfiles

I recently moved my dotfiles to a private location. This goes against my previous belief in sharing the knowledge and allowing other to read and learn from my configuration.

Below is why:

Privacy