J—P

Limited availability — accepting new projects starting January 2027.

Generate Secure Passwords with pwgen

Two tiny shell functions around pwgen for generating random passwords from the terminal: pw for letters and digits, pwspec for when a site wants special characters too. Both default to 20 characters.

brew install pwgen

Add these to your ~/.zshrc (or ~/.bashrc):

# Random password: 20 chars from a-z A-Z 0-9; `pw 5` prints five
pw() { pwgen -s -1 20 "${1:-1}"; }
# Same, with special characters mixed in
pwspec() { pwgen -s -y -1 20 "${1:-1}"; }

What the flags do:

  • -s makes passwords fully random. Without it, pwgen generates pronounceable ones, which are easier to remember but weaker.
  • -y adds special characters.
  • -1 prints one password per line instead of filling the screen with columns.

Capital letters and numbers are on by default, and every password gets at least one of each.

Usage

pw            # one password
pw 5          # five passwords
pwspec        # one password with special characters
pw | pbcopy   # straight to the clipboard

How to Reset a Single File in Git

If you've made changes to a file and want to discard them, you can use git checkout to restore it to the version from the last commit. This is useful when you want to undo changes that haven't…