Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am cjyar on github.
  • I am cjyar ( on keybase.
  • I have a public key ASBkC_tdKZtXzyLoSbGgLcRW9fprOPKQHKijFOSU64mMXQo

To claim this, I am signing this object:

cjyar /
Last active September 30, 2021 03:45
How to listen to an expert

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 /
Last active April 22, 2024 15:49
Convert a disk from MBR to GPT+UEFI, in Linux.

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.


  4. Reload the partition table. > partprobe /dev/sda
cjyar /
Last active March 19, 2024 17:13
Secure OpenPGP Configuration


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 / memoize.go
Created December 1, 2013 01:29
Generic memoizer in Go.
package memoize
import (
// 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