Skip to content

Instantly share code, notes, and snippets.

View dennismclaugh's full-sized avatar

dennismclaugh

View GitHub Profile
@dennismclaugh
dennismclaugh / read_parameters_from_aws.rb
Last active April 8, 2019 20:57
Demonstration of how to read secrets from AWS Parameter Store using Ruby. https://www.dennismclaughlin.tech/use-aws-parameter-store-to-guard-your-secrets/
require 'aws-sdk-ssm'
class AWSHelper
@@ssm_parameters = []
@@test_environment = nil
# Reads and stores Parameter Store values for a particular path.
def self.load_ssm_parameters(test_environment)
@@test_environment = test_environment
@dennismclaugh
dennismclaugh / save_parameters_to_aws.sh
Last active April 8, 2019 21:12
Short script that demonstrates how to save secrets up in AWS Parameter Store.
# This script will automatically add and update secrets in the AWS Parameter Store.
# Example: "./set_parameters_to_aws.sh test_environment.txt" will store the secrets at path /WebDriver_Tests/my_parameters
#
# Check if an input file was specified
if [ $# -eq 0 ] || [ ! -f $1 ]; then
echo
echo "No test environment specified or config file not found. Example usage '$ set_parameters_to_aws.sh tesT_environment.txt'"
echo
exit 1
require 'aws-sdk-s3'
# Saves a file to an AWS S3 bucket.
def store_file_in_s3
Aws.config.update({
region: 'us-east-1'
credentials: Aws::Credentials.new('AWS_ACCESS_KEY_GOES_HERE', 'AWS_SECRET_KEY_GOES_HERE')
})
bucketname = 'my_s3_bucket'
@dennismclaugh
dennismclaugh / dockerfile
Last active January 17, 2020 22:25
Dockerfile based on Alpine Linux complete with Ruby, Watir Webdriver, Shopify API, Chrome, and Firefox. https://www.dennismclaughlin.tech/build-docker-image-ruby-watir-webdriver-shopify-and-chrome/
FROM alpine:latest
# Point to specific Alpine Package repositories for Chromium and Firefox.
RUN apk update && apk upgrade \
&& echo @latest-stable http://nl.alpinelinux.org/alpine/latest-stable/community >> /etc/apk/repositories \
&& echo @latest-stable http://nl.alpinelinux.org/alpine/latest-stable/main >> /etc/apk/repositories \
&& echo @edge-testing http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories \
&& echo @edge-main http://dl-cdn.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories
# Install Ruby dev environment