Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am cjyar on github.
  • I am cjyar (https://keybase.io/cjyar) on keybase.
  • I have a public key ASBkC_tdKZtXzyLoSbGgLcRW9fprOPKQHKijFOSU64mMXQo

To claim this, I am signing this object:

@cjyar
cjyar / experts.md
Last active Sep 30, 2021
How to listen to an expert
View experts.md

How to Listen to an Expert

  1. Listen to the expert in their field. When Carmen the cardiac surgeon tells me I need to get more aerobic exercise, I pay attention. She knows more about my heart than I do.
  2. Don't listen to the expert outside of their field. My cardiac surgeon doesn't know any more about designing computers than anybody else off the street.
  3. Choose the more educated expert. If the cardiac nurse tells me to run 3 miles a week, I'll do 3. If the surgeon says to run 5, then I'll do 5.
  4. Choose the more specialized expert. My family doctor has good advice on keeping my heart healthy, but not as good as the cardiac surgeon's advice.
@cjyar
cjyar / mbr-to-gpt-uefi.md
Last active Jun 17, 2019
Convert a disk from MBR to GPT+UEFI, in Linux.
View mbr-to-gpt-uefi.md

Before starting, make sure you have a backup, and make sure to have a linux live boot ready to rescue your system. It's easy to mess this up!

  1. Use gdisk to convert the partition table to GPT.

    gdisk /dev/sda

  2. Create the "BIOS boot" partition that GRUB needs.

    n to create a new partition. Needs to be about 1MB. You can probably squeeze this in from sectors 34-2047. Use L or l to look up the code for "BIOS boot" (ef02).

  3. Write the new partition table.

    w

  4. Reload the partition table.

    partprobe /dev/sda

@cjyar
cjyar / pgp.md
Last active May 7, 2021
Secure OpenPGP Configuration
View pgp.md

Discussion

You can have many different levels of security with PGP. For lots of people, keeping your master key on your computer is good enough, and it's better than no PGP at all. But this guide is my max-security PGP setup. Here are the threats and mitigations that I'm concerned with:

  • Quantum cracking: It's likely that someday people will be able to crack RSA and DSA keys using quantum computers. ECC keys are likely also crackable, but can be faster, shorter, and possibly more secure. There's some controversy about which type of ECC keys to use; I settled on Curve 25519.
  • Key reuse: It's a bad idea to reuse your encryption key for signing. (It's safe with current algorithms, but it
@cjyar
cjyar / memoize.go
Created Dec 1, 2013
Generic memoizer in Go.
View memoize.go
package memoize
import (
"fmt"
"reflect"
)
// fptr is a pointer to a function variable which will receive a
// memoized wrapper around function impl. Impl must have 1 or more
// arguments, all of which must be usable as map keys; and it must