Skip to content

Instantly share code, notes, and snippets.

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:
# Modified version for Rails 6 at:
thornomad /
Created Apr 18, 2020 — forked from chrisroos/
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...
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;