Skip to content

Instantly share code, notes, and snippets.

View chrisroos's full-sized avatar

Chris Roos chrisroos

View GitHub Profile
@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@chrisroos
chrisroos / README.md
Last active November 25, 2023 07:00
Example of using bundler/inline

I came across 'bundler/inline' in Bundler pull request 3440, which I'd found from Rails pull request 20429. This now has a little snippet on the What's new page of the Bundler site.

This little example demonstrates how I might use it to create a single file using minitest.

I've just noticed that this script was working for me because I already had minitest installed as a system gem. If I uninstall the gem then the script fails because it can't find minitest. The source code documents an option to install gems if they don't exist (gemfile(true) do) but that doesn't seem to work for me. I see the following error:

Fetching gem metadata from https://rubygems.org/...
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...

Using metaclass 0.0.4

@chrisroos
chrisroos / README.md
Created April 17, 2015 11:21
Configuring Apache, Passenger and Dnsmasq of Mac OS X

Configure Dnsmasq to respond to *.dev

Assuming it's been installed using Homebrew.

Add the following to dnsmasq.conf (/usr/local/etc/dnsmasq.conf).

address=/dev/127.0.0.1

Stop and start the service:

Testing Rails ActionMailer and AWS SES

I added two verified email addresses to AWS SES so that I could send emails from/to them while in the SES Sandbox.

UserMailer

class UserMailer < ApplicationMailer
  default from: 'accounts+aws-ses@gofreerange.com'
@chrisroos
chrisroos / rails-and-heroku-and-lets-encrypt-ssl.md
Last active November 23, 2021 01:21
Using a Let's Encrypt SSL certificate to serve a Rails app on Heroku

Intro

This is very similar to Collective Idea's blog post, "[Let's Encrypt with a Rails app on Heroku][collective-idea-blog-post]". I ran through the process a couple of times to try to understand how the various parts fit together.

Create a new Rails app

NOTE. I'm skipping Active Record to make the deployment to Heroku slightly easier.

$ rails new rails-app-with-lets-encrypt --skip-active-record
@chrisroos
chrisroos / Gemfile
Created May 20, 2015 17:42
Comparison of the various ERB trim modes available
source 'https://rubygems.org'
gem 'minitest'
@chrisroos
chrisroos / Gemfile
Last active July 12, 2021 16:36
Exploring how to run specific tests using minitest
source 'https://rubygems.org'
gem 'shoulda'

Keybase proof

I hereby claim:

  • I am chrisroos on github.
  • I am chrisroos (https://keybase.io/chrisroos) on keybase.
  • I have a public key ASAHSRfXQ5NzVNyEmSsHC02aqeI4TZmm-_XI-RiUSAYQXAo

To claim this, I am signing this object:

@chrisroos
chrisroos / background-colour-fadeout-test.html
Created September 16, 2011 14:56
Playing around with fading out background colours using pure Javascript.
<!DOCTYPE html>
<html>
<head>
<title>Background colour fadeout test</title>
</head>
<body>
<h1>Background colour fadeout test</h1>
<p>I wanted to work out how to fade background colours using pure Javascript.</p>
<script src="fadeout.js" type="text/javascript" charset="utf-8"></script>
</body>
@chrisroos
chrisroos / redcloth-4.2.6-test.md
Created February 11, 2011 12:54
Steps to test/fix RedCloth 4.2.6 on Mac OS X

Intro

RedCloth 4.2.6 is broken on Mac OS X. It appears to be related to the case sensitive require fix. These steps expose and fix the problem on my machine.

Software versions

$ ruby -v
ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-darwin10.3.0], MBARI 0x6770, Ruby Enterprise Edition 2010.01

$ gem -v