motd-manager.sh is a Bash utility for managing a clean, colored dynamic MOTD (Message of the Day) on Raspberry Pi or Debian-based systems. It replaces the default kernel banner and legal boilerplate with a concise, informative, and visually distinct MOTD that includes host information, OS version, uptime, network details, and board type (if running on a Raspberry Pi).
| #!/usr/bin/env bash | |
| # | |
| # Environment diagnostics for build failures | |
| # Collects system, CPU, memory, swap, disk, and compiler info | |
| # | |
| set -e | |
| clear | |
| printf "%s\n\n" "=== System ===" |
If you use a laptop tucked away as a Linux host, you may want to disable any power manegement (sleep/hibernate) as well as any desktop environments, use this script:
wget -qO- https://gist.githubusercontent.com/lbussy/2884187dcad127b1b9ad3bbeb5697d90/raw/disable_power_and_gui.sh | sudo bashIf you wish to reverse it:
This script automates the process of synchronizing a Git repository by ensuring all remote branches are tracked locally, pulling updates with fast-forward-only behavior, updating submodules (when present), and optionally deleting local branches that no longer exist on the remote.
- Clones the repo (with submodules) if not already present
- Fetches and prunes all remote branches
- Tracks all
origin/*branches as local branches if missing - Checks out each branch:
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| IFS=$'\n\t' | |
| # ----------------------------------------------------------------------------- | |
| # @file rename_git_branch.sh | |
| # @brief Script to rename a Git branch both locally and on the remote | |
| # repository. | |
| # | |
| # @details |
| # ----------------------------------------------------------------------------- | |
| # MIT License | |
| # | |
| # Copyright (c) 2025 Lee C. Bussy (@lbussy) | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal | |
| # in the Software without restriction, including without limitation the rights | |
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| # copies of the Software, and to permit persons to whom the Software is |
whitespace_clean is a Bash script designed to remove extraneous whitespace from source code and text files. It helps maintain clean, readable files by stripping trailing whitespace from supported file types.
- Processes files recursively or in a single directory
- Supports dry-run mode to preview changes
This script demonstrates how to implement debug functionality to a Bash script in a simple, extensible manner. It provides a mechanism to enable and pass debug information throughout the script, allowing developers to trace function calls and view debug messages during execution.
How is this different than just dropping echo everywhere?