Skip to content

Instantly share code, notes, and snippets.

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 / 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 }
@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 / 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: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 / 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 / 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 / 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 / README.md
Last active December 18, 2015 09:39
Rails Vendor Mime Types

Example of using Vendor MIME Types to determine how to route a request coming into a Rails application.

@weavenet
weavenet / gist:3056161
Created July 5, 2012 20:11
Create an X.509 Signing Cert for AWS IAM User
# Generate the csr / key
openssl genrsa -des3 -out server.key 1024
# Generate the CSR
openssl req -new -key server.key -out server.csr
# Remove the password from the key
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key