Debian Server from Scratch
A quick guide on setting up a minimal but secure HTTPS web server on a Debian (12) Linux server.
A quick guide on setting up a minimal but secure HTTPS web server on a Debian (12) Linux server.
To create and authorize a new SSH:
ssh-keygen -t ed25519 on the client machine..ssh folder and the name of the id (id_*).*.pub file to whatever service the SSH key is for, or add it to ~/.ssh/authorized_keys on the host machine.~/.ssh/config file (for macOS at least). Be sure to fill in the <fill-me> parts
Host <choose-a-name>
HostName <ip-or-domain-here>
User <username>
AddKeysToAgent yes
UseKeychain yes
IdentitiesOnly yes
IdentityFile ~/.ssh/<your-non-pub-id-file-name>
ssh choose-a-name (use the name you entered next to Host in the config file).For cleaner tsc (TypeScript compiler) output: pipe its output into my package tidy-tsc:
npm i -g tidy-tsc
npx tsc | tidyt
npx tsc -b | tidyt # etc.
# in one of my packages
npm run compile | tidyt
| tidyt cleans up the tsc output so instead of seeing tons of logs for every single file's errors like this:
src/file.ts:9:18 - error TS2304: Cannot find name 'missingValue'.
9 const value = missingValue;
~~~~~~~~~~~~
src/file.ts:18:15 - error TS7006: Parameter 'char' implicitly has an 'any' type.
18 .map((char, index) => (index % 2 ? char.toUpperCase() : char.toLowerCase()))
~~~~
src/file.ts:18:21 - error TS7006: Parameter 'index' implicitly has an 'any' type.
18 .map((char, index) => (index % 2 ? char.toUpperCase() : char.toLowerCase()))
~~~~~
Found 3 errors.
All you see is this:
Failed files (1):
src/file.ts
My (very) opinionated Git conventions. If you follow these, you will be much less likely to create messed up git histories, and your git setup will make much more sense.
An idea for a postmortem template.
A guide on how to setup git commit signing through GPG and GitHub.
For a long time I, someone on my team, would wait for backend pipelines to finish before manually publishing deploys from Netlify. I finally automated it: here's how! (If you have auto-publish turned on for your production deploys, you don't need this.)
If you set --prefer-offline to true in npm, naively thinking (like I did) that this will speed up your npm installs, you will be disappointed (like I was). Annoyingly, this setting causes npm to also cache which packages and versions don't exist. Thus, updating a dependency to a newly published version causes npm to think it doesn't exist and, instead of doing anything about it, npm will simply error out.
Clone a repo with worktrees setup from the start:
mkdir <repo-name>
cd <repo-name>
git clone --bare --filter=blob:none <git-url>
cd <repo-name>.git
Some options to help your sanity:
# always prune on fetch
git config fetch.prune true
# allow `git fetch origin <branch-name>` to work as expected (create a remote ref)
git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
To create a new branch:
git worktree add ../<branch-name>
cd ../<branch-name>
To copy a remote branch (note that this will only work with the above fetch config set):
git fetch origin <branch-name>
git worktree add ../<branch-name>
cd ../<branch-name>
To create a new branch based on a remote branch:
git worktree add ../<branch-name> -b <branch-name> --no-track origin/dev
cd ../<branch-name>
This how to enable up/down arrow auto-complete navigation instead of basic history navigation, without installing plugins.
nano ~/.inputrc
Paste in:
"\e[A": history-search-backward
"\e[B": history-search-forward
Run:
bind -f ~/.inputrc
Put the following into your ~/.zshrc:
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey '^[[A' up-line-or-beginning-search # Up arrow
bindkey '^[[B' down-line-or-beginning-search # Down arrow