Skip to content

Instantly share code, notes, and snippets.

View jadengis's full-sized avatar

John Dengis jadengis

View GitHub Profile

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

Gotten from the RedHat GPG migration manual

Backup the public and secret keyrings and trust database

## Export all public keys

gpg -a --export >mypubkeys.asc

@jadengis
jadengis / Dockerfile
Created March 8, 2025 05:08
Simple docker setup with application builds in docker compose.
# syntax = docker/dockerfile:1
ARG NODE_VERSION=22
ARG VERSION="unknown"
FROM node:${NODE_VERSION}-alpine as base
ENV VERSION=${VERSION}
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
FROM base as build
@jadengis
jadengis / reserved_usernames.ex
Last active May 9, 2023 03:36 — forked from caseyohara/reserved_usernames.rb
A list of reserved usernames to avoid vanity URL collision with resource paths
# A list of possible usernames to reserve to avoid
# vanity URL collision with resource paths
# It is a merged list of the recommendations from this Quora discussion:
# http://www.quora.com/How-do-sites-prevent-vanity-URLs-from-colliding-with-future-features
# Country TLDs found here:
# http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains
# Languages found here:
@jadengis
jadengis / table.ex
Created December 24, 2022 03:01
Phoenix table component
@doc ~S"""
Renders a table with generic styling.
## Examples
<.table id="users" rows={@users}>
<:col :let={user} label="id"><%= user.id %></:col>
<:col :let={user} label="username"><%= user.username %></:col>
</.table>
"""
@jadengis
jadengis / custom-oauth-apps.md
Created September 4, 2021 19:23
How to customize OAuth Apps for Firebase

How to customize OAuth Apps for Firebase

By default, Firebase Auth uses some pretty naive configurations for you Google OAuth App. I can never remember how to configure this so I'm going to write this note for posterity.

There are 3 things that you will want to confgure to use branded URLs:

  • The authDomain firebase config property. This tells the Firebase SDK how to construct redirect URLs when logging in with providers.
  • Authorized domains on OAuth consent screen - this is available from the API & Services tab in the Google Cloud Platform console.
  • Redirect URIs - Navigate to the Credentials section of the API & Services tab in the Google Cloud Platform console and edit the Web Client OAuth 2.0 Client Id and add the custom redirect URI.
@jadengis
jadengis / propery-delegation.js
Created May 30, 2020 19:42
Delegating properties to a wrapper class
// Reduce an object to a property delegation object
function createDelegators(value) {
const props = Object.getOwnPropertyNames(value)
const delegates = props.reduce((acc, next) => {
acc[next] = { get: () => value[next] }
return acc
}, {})
return delegates
}
@jadengis
jadengis / simple.spec.ts
Created February 8, 2020 06:42
Angular 9 testing bad error messages
import { Injectable, Optional } from "@angular/core";
import { TestBed } from "@angular/core/testing";
@Injectable({ providedIn: "root" })
class Foo {}
@Injectable({ providedIn: "root" })
class Bar {
constructor(@Optional() public foo: Foo | null) {}
}
@jadengis
jadengis / move-catch-error.cpp
Created March 14, 2017 12:46
This code generates a runtime error when compiled with GCC 6
// compile command: g++-6 -Wall -Wextra -std=c++14 move-catch-error.cpp -o test.out
// Weird issue with move semantics, exceptions, try and catch.
#include <string>
#include <sstream>
#include <iostream>
#include <exception>
class SomeException : std::exception {
public:
// basic constructor