Skip to content

Instantly share code, notes, and snippets.

@m-radzikowski
m-radzikowski / script-template.sh
Last active October 9, 2025 00:41
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@jesstess
jesstess / music_through_dev_dsp.py
Created November 15, 2010 02:11
Construct tones yourself and play them through /dev/dsp
#!/usr/bin/python
# Play music without any external files (ie you create the notes yourself)
# through /dev/dsp! Inspired by
# http://www.tldp.org/LDP/abs/html/devref1.html#MUSICSCR
def generate_notes():
# See http://www.phy.mtu.edu/~suits/NoteFreqCalcs.html for details on
# calculating the frequencies