Skip to content

Instantly share code, notes, and snippets.

View datsun240z's full-sized avatar

Ron Belaire datsun240z

  • Ciena
  • Canada
  • 04:19 (UTC -04:00)
View GitHub Profile
@m-radzikowski
m-radzikowski / script-template.sh
Last active June 25, 2024 12:02
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...]
@rbanffy
rbanffy / gist:9c806ba406dba9a5afa324d0be3b8f13
Last active November 19, 2021 20:08
Find out more about your CPU
open http://www.google.com/?q=$(sysctl -n machdep.cpu.brand_string | awk '{FS=" " ; print $2 "+" $3 "+" $4}')+site:ark.intel.com
or, on a Linux machine
xdg-open http://www.google.com/?q=$(fgrep 'model name' /proc/cpuinfo | head -n 1 | awk '{FS=" " ; print $5 "+" $6}')+site:ark.intel.com
@caruccio
caruccio / bash-path-vars
Last active December 28, 2023 22:47
Path manipulation with bash vars
$ FILE=/some/path/to/file.txt
###################################
### Remove matching suffix pattern
###################################
$ echo ${FILE%.*} # remove ext
/some/path/to/file
$ FILE=/some/path/to/file.txt.jpg.gpg # note various file exts