Skip to content

Instantly share code, notes, and snippets.

View hemju's full-sized avatar
😃
Work Work

Helmut M Juskewycz hemju

😃
Work Work
View GitHub Profile
@hemju
hemju / connect-heroku-app-to-postgres-rds-with-ssl.md
Created June 21, 2017 15:03 — forked from glarrain/connect-heroku-app-to-postgres-rds-with-ssl.md
How to connect a Heroku application to an Amazon RDS PostgreSQL instance, forcing SSL and certificate chain verification

1 - Download the RDS certificates (root plus region-specific intermediate ones) bundle:

wget -O config/rds-combined-ca-bundle.pem https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem

2 - Add config/rds-combined-ca-bundle.pem to the repository and redeploy to Heroku.

3 - Update the DATABASE_URL env var:

# Taken from http://benoithamelin.tumblr.com/ruby1line/ All credits go to Benoit Hamelin
# Ruby one-liners
# This is a translation of Eric Pement’s collection of Awk one-liners as Ruby one-liners. These so-called one-liners are small programs that hold on a single (sometimes longish) line of code, so it may be run from the command line, typically for text processing purposes. So, all problems solved by Awk one-liners on the page linked above are solved here in Ruby, sorted along the same categories as Pement’s work. In some cases, multiple solutions are proposed, as they outline nice features or idiosyncrasies of the Ruby language and conventions.
# Note that this is not the first collection of Ruby one-liners: googling “Ruby one-liner” yields multiple hits. However, I have put up this collection by myself, without looking at other solutions, for the sake of practice. I have posted about what generalities I have learned throughout this exercise here.
# File spacing
# Double-space a file.
ruby -ne 'print; pu