Skip to content

Instantly share code, notes, and snippets.

View alecdwm's full-sized avatar

Alec WM alecdwm

View GitHub Profile
@alecdwm
alecdwm / my-ts-monorepo.md
Created November 7, 2024 03:50 — forked from manzt/my-ts-monorepo.md
A minimal setup for TypeScript monorepo libraries

My Minimal TypeScript Monorepo Setup for ESM Libraries

After a deep dive looking up best practices for TypeScript monorepos recently, I couldn't find anything that suited my needs:

  1. Publish individual (typed) packages to NPM with minimal config.
  2. Supports fast unit testing that spans the entire project (e.g., via Vitest)
  3. Ability to have an interactive playground to experiment with the API in a real-time (e.g., via Vite)

Most solutions point to TypeScript project references,

@alecdwm
alecdwm / server_name.sh
Created March 12, 2018 03:50
My preferred method of connecting to personal servers
# On the first attempted connection since an ssh-agent restart,
# you will be prompted for your ssh key's passphrase.
#
# On the first attempted connection since a server restart,
# a new tmux session will be created.
#
# On subsequent connections, the existing tmux session will
# be used.
#
# Usage:
@alecdwm
alecdwm / countdown.sh
Last active March 12, 2018 03:18
A small countdown timer in bash
#!/bin/bash
# Usage: countdown --help
while test $# -gt 0; do
case "$1" in
"-h"|"--help")
showhelp="true"
shift; continue;;
"-v"|"--version")
@alecdwm
alecdwm / get-sha256-fingerprint.sh
Created March 12, 2018 03:12
Fetch the sha256 fingerprint of a TCP server's TLS cert
#!/bin/bash
# Works for any TLS-enabled TCP server, but originally intended for
# fetching the sha256 fingerprint of an irc server's TLS cert
# when the server refuses to use certificates from a trusted CA.
#
# Example:
# $ get-sha256-fingerprint.sh irc.owls.io:6697
openssl s_client -connect "$1" < /dev/null 2>/dev/null | openssl x509 -fingerprint -sha256 -noout -in /dev/stdin | sed -e "s/://g"
@alecdwm
alecdwm / freem.sh
Last active April 5, 2021 10:32
A quick script to check whether your system's current memory usage could fit entirely inside its swap space
#!/bin/bash
# A quick script to check whether your system's current memory
# usage could fit entirely inside its swap space.
#
# Might be useful in determining the likelihood of a
# successful suspend to disk operation.
MEM_USED=$(free -m | grep Mem | awk '{print $3}')
SWAP_FREE=$(free -m | grep Swap | awk '{print $4}')

Keybase proof

I hereby claim:

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

To claim this, I am signing this object: