Skip to content

Instantly share code, notes, and snippets.

@thornomad
thornomad / add_frozen_string_literal_comment.rb
Last active Nov 19, 2020 — forked from ta1kt0me/add_frozen_string_literal_comment.rb
Add frozen string literal comment into generated files in rails v5.1.0
View add_frozen_string_literal_comment.rb
# frozen_string_literal: true
# Adds a `frozen_string_literal` comment to the top of files created by Rails
# generators.
#
# Originally inspired by:
# https://gist.github.com/ta1kt0me/6a7058d16621785d4f7038bde6cd3b98
# Modified version for Rails 6 at:
# https://gist.github.com/thornomad/4e2f0905e2a4a6eefbc4be5772dfd4f7
@thornomad
thornomad / gpg-import-and-export-instructions.md
Created Apr 18, 2020 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys
View gpg-import-and-export-instructions.md

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...
View rails-6-test.log
(499.2ms) CREATE DATABASE "test_app_6_test" ENCODING = 'unicode'
(19.8ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)
(7.6ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp(6) NOT NULL, "updated_at" timestamp(6) NOT NULL)
(0.2ms) SELECT pg_try_advisory_lock(6568561817215537440)
(0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Migrating to CreateTableAndViewForTesting (20200122031151)
(0.2ms) BEGIN
(3.6ms) CREATE TABLE "people" ("id" bigserial primary key, "name" character varying)
(0.9ms) DROP VIEW IF EXISTS view_people;
CREATE OR REPLACE VIEW view_people AS