Skip to content

Instantly share code, notes, and snippets.

View BrianSigafoos's full-sized avatar

Brian Sigafoos BrianSigafoos

View GitHub Profile
@BrianSigafoos
BrianSigafoos / aws_iam_secret_to_smtp_password.md
Created October 29, 2022 23:31 — forked from damusix/aws_iam_secret_to_smtp_password.md
Convert AWS IAM credentials to AWS SMTP credentials

Convert AWS IAM credentials to AWS SMTP credentials

If you do, or want to, use AWS to deploy your apps, you will end up using AWS SES via SMTP when you're launching an app that sends out emails of any kind (user registrations, email notifications, etc). For example, I have used this configuration on various Ruby on Rails apps, however, it is just basic SMTP configurations and crosses over to any framework that supports SMTP sendmail.

There are two ways to go about this:

Luckily, you found this MD file and the NOT SO EASY WAY is suddenly copy-pasta... sudo yum....

@BrianSigafoos
BrianSigafoos / mock_env.rb
Created August 23, 2021 11:46 — forked from jazzytomato/mock_env.rb
Simple method to mock environment variable in ruby with minitest or other testing framework
# in test_helper.rb (for example)
def mock_env(partial_env_hash)
old_env = ENV.to_hash
ENV.update partial_env_hash
begin
yield
ensure
ENV.replace old_env
end
end
@BrianSigafoos
BrianSigafoos / stimulus.md
Created September 20, 2019 15:33 — forked from mrmartineau/stimulus.md
Stimulus cheatsheet
@BrianSigafoos
BrianSigafoos / nginx_source_pagespeed_passenger_ubuntu.md
Created June 23, 2019 15:52 — forked from benbonnet/nginx_source_pagespeed_passenger_ubuntu.md
nginx from source with pagespeed and passenger on ubuntu 16.04 and above
sudo apt-get -y update
sudo apt-get install -y build-essential libcurl4-openssl-dev unzip software-properties-common git libpcre3-dev libpcre3

adding zlib, openssl and pcre

cd && mkdir sources && cd sources
wget https://downloads.sourceforge.net/project/pcre/pcre/8.41/pcre-8.41.tar.gz && tar xzvf pcre-8.41.tar.gz
@BrianSigafoos
BrianSigafoos / db.rake
Created May 9, 2019 13:32 — forked from khalilgharbaoui/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# Original source: https://gist.github.com/hopsoft/56ba6f55fe48ad7f8b90
# Merged with: https://gist.github.com/kofronpi/37130f5ed670465b1fe2d170f754f8c6
# Benefits of: https://gist.github.com/e12e/e0c7d2cc1d30d18c8050b309a43450ac
# And fixes of: https://gist.github.com/joelvh/f50b8462611573cf9015e17d491a8a92
namespace :db do
desc 'Dumps the database to backups'
task dump: :environment do
dump_fmt = ensure_format(ENV['format'])
dump_sfx = suffix_for_format(dump_fmt)
backup_dir = backup_directory(Rails.env, create: true)
@BrianSigafoos
BrianSigafoos / aws_create_users_ubuntu.sh
Created February 4, 2019 15:43 — forked from vasansr/aws_create_users_ubuntu.sh
AWS User Data Script to create users when launching an Ubuntu server EC2 instance
#!/bin/bash
#
# Initial script to create users when launching an Ubuntu server EC2 instance
#
declare -A USERKEY
#
# Create one entry for every user who needs access. Be sure to change the key to their
@BrianSigafoos
BrianSigafoos / capybara.md
Created August 31, 2017 20:55 — forked from remi/capybara.md
RSpec Matchers

Capybara

save_and_open_page

Matchers

have_button(locator)
@BrianSigafoos
BrianSigafoos / README.md
Created August 24, 2017 18:54 — forked from joyrexus/README.md
curl tutorial

An introduction to curl using GitHub's API.

Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin

Includes HTTP-Header information in the output

@BrianSigafoos
BrianSigafoos / postgres-cheatsheet.md
Created January 25, 2017 17:38 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

@BrianSigafoos
BrianSigafoos / ssl_puma.sh
Created January 13, 2017 17:35 — forked from tadast/ssl_puma.sh
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key