Skip to content

Instantly share code, notes, and snippets.

View alecdwm's full-sized avatar

Alec WM alecdwm

View GitHub Profile

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:

@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 / 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 / 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}')
@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"