Skip to content

Instantly share code, notes, and snippets.

View stefanfrede's full-sized avatar

Stefan Frede stefanfrede

View GitHub Profile
@stefanfrede
stefanfrede / gpg-import-and-export-instructions.md
Created November 7, 2019 14:37 — forked from chrisroos/gpg-import-and-export-instructions.md
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...

@stefanfrede
stefanfrede / async_chained_api.js
Created December 17, 2019 17:45
Chained APIs with Asynchronous Functions
// Given
class Solar {
getBaseMap(callback) {
setTimeout(function() {
callback();
console.log('Getting Base Map');
}, 600);
}
drawRoofOutline(callback) {
setTimeout(function() {
@stefanfrede
stefanfrede / unique_id.js
Created January 15, 2020 12:42
Generate a unique id in the browser without a library
function randomId() {
const uint32 = window.crypto.getRandomValues(new Uint32Array(1))[0];
return uint32.toString(16);
}
const rid = randomId();
@stefanfrede
stefanfrede / yubikey+gpupgp+ssh_howto.md
Created January 9, 2021 11:09 — forked from xirkus/yubikey+gpupgp+ssh_howto.md
Security Adventures 1. How to get yubikey+gpg+ssh+gitbhub working on MacOS

I've spent the day trying to get this setup working with GitHub and given the number of gotcha's I encountered, it seemed like a good idea to document how I finally got this working with as few hacks as possible. There's a lot of documentation out there (some of it old and misleading) and committing here for posterity will help me remember this when I inevitably need to do this again.

Rationale

Passwords are simply not enough these days. Regardless of the company, breaches (and the associated Personally Identifiable Information harvested) are a matter of not if, but when. There are a number of things you can do to protect yourself, but being on the tin-foil-hat side of paranoia, means there are a few Commandents that I adhere to (and recommend for other folks)[Insert link to Fight Club Rules for the Secure Internet].

That being said, if you use 2-factor authentication and have committed to using a hardware token such as the Yubikey, then you're already ahead of the curve. The problem is that wh

@stefanfrede
stefanfrede / machine.js
Created January 29, 2021 16:15
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine(
{
id: 'fetch',
initial: 'idle',
context: {
data: null,
error: null,
},
states: {
idle: {
@stefanfrede
stefanfrede / ddev-debug.txt
Created November 11, 2022 12:44
DDEV Debug Output
Running bash [-c /tmp/test_ddev.sh]
OS Information: Linux wyn-lin-01 5.15.0-10052-tuxedo #58~20.04.1tux1 SMP Mon Oct 24 12:05:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
User information: uid=1001(sfrede) gid=1001(sfrede) groups=1001(sfrede),27(sudo),46(plugdev),131(vboxusers),996(docker),997(rslsync),1000(support)
DDEV version: ITEM VALUE
DDEV version v1.21.3
architecture amd64
db drud/ddev-dbserver-mariadb-10.4:v1.21.3
dba phpmyadmin:5
ddev-ssh-agent drud/ddev-ssh-agent:v1.21.3
docker 20.10.21