Utilities to ease your life.
Scripts that I use on a daily basis, or on new system installs, that improve my experience with Linux substantially!
They are sorted by how much utility they provide me.
- [2024-08-29 07:49:02 CDT] [bash-timer] Added support for locales with the comma decimal separator.
- [2024-09-01 12:31:33 CDT] [bash-timer] Properly pad ms to 3 digits.
- [2024-09-01 12:41:07 CDT] [bash-timer] Greatly refactored ns math to properly calculate seconds and ms.
- [2024-09-10 02:20:14 CDT] [bash-timer] Fixed the "value too great" error.
- [2024-09-11 02:22:12 CDT] [bash-timer] Supported non-decimal locales, properly in Bash v5.
- [2024-08-24 12:06:32 CDT] [bash-timer] Added the bash-timer project.
- [2024-08-23 07:09:10 CDT] [git-same-sig-time] Added proper support for time zones different than the user's computer.
- [2024-08-12] Majorly cleaned up the README and translated to Chinese, Hindi, and Spanissh.
- [2024-08-12] [turn-off-monitors] Added full support for turning off monitors in Wayland for Gnome and KDE.
- [2024-08-12] [arch-pacman-dupe-cleaner] Require superuser to run.
- [2024-08-12] [gitconfig] Automatically time out git when websites are not reachable.
- [2024-08-12] [bash_rc.aliases] Replace ssh with mosh, if it is installed.
- [2024-08-12] [bash_rc.aliases] Added an alias to make
watch
honor ~/.bashrc aliases. - [2024-08-12] [framework/wait_until_mouse_or_keyboard_event] Block execution until a key is pressed, the mouse is moved, or a mouse button is clicked.
- [2024-08-12] [framework/is_root] Added a function for determining root access.
- [2024-08-12] [launch-browser] Launch Chrome-based browsers in native Wayland.
- [2024-08-12] Added a .bash_profile.
-
Super Productivity
- bash_profile — High-quality
.bash_profile
and.bashrc
for power users. - bash_rc.aliases — High-Octane .bashrc aliase and functions for a better Quality of Life.
- bash-timer — Easily add Human-readable execution time for every command in bash!
- ssh-autologin — Automatically set up SSH autologins.
- ssh-keyphrase-only-once — Only prompt for your SSH keyphrase once per boot.
- gitconfig — High-Octane Git CLI Configuration.
- bash_profile — High-quality
-
Git Quality of Life
- git-change-author — Easily bulk change the author's name and email in a git repo.
- git-commit-at-modded-time — Use a file's modified time as the git time.
- git-mtime — Restores every file's modification time to that of the repo's history.
- git-same-sig-time — Unifies the GPG signature time with the commit's time.
- git-shallow-pull — Shallow updates a shallow
git clone --depth 1
repository.
-
CronTabs
- cron.daily/00_clear-cache — Remove useless cache files nightly.
- cron.daily/01_purge-locales — Remove worthless intl locales.
- cron.hourly/btrfs-snapshot — Backup your BTRFS / hourly.
- cron.daily/btrfs-snapshot — Backup your BTRFS / daily.
- cron.hourly/php-clean-tmp — Cleans PHP temp files on busy servers.
-
Quality of Life
- launch-browser — Browser launcher utility script that launches browsers in full-Wayland.
- ls-by-min — Sorts the output of
ls
by file size, descending. - random-file — Randomly picks a file or directory and displays it.
- sudoers.d/00_prompt_once — Only prompt for your sudo password once per boot.
- sync-watch — Outputs a tiny, updating display of how many MBs need to be written to disks.
- tar-sorted — Create tar files automatically sorted by file name.
- turn-off-monitors — Turns off all monitors via the Command Line (CLI).
-
Uber Scripts (很好的控制台脚本)
- american-date — A utility to print out dates in the American format.
- changelog-maker-lite — Quickly creates a beautiful changelog from the commit history.
- stream-to-youtube — Live Screencast directly to YouTube from the CLI.
- watermark.sh — Easily embed your own image watermark onto videos.
- wifi-autorun-on-connect — Autorun a script when you connect to a Wifi hotspot.
- x265.sh — Transcode to h265 HEVC via the Intel graphics card using VAAPI.
-
Esoteric Utilities
- arch-pacman-dupe-cleaner — Remove duplicated Arch Linux Pacman entries.
- init-btrfs-rootfs — Puts everything into organized BTRFS subvolumes + turns on snapshotting.
- clone-github-repos.php — Downloads all of a user's/org's GitHub repositories.
-
Bash Framework
- is_root — Provides the
is_root
function for determining if the current user has root access. - wait_until_mouse_or_keyboard_event — Block execution until a key is pressed, the mouse is moved, or a mouse button is clicked.
- is_root — Provides the
-
License — Creative Commons v4.0 International
Ties many of the BashScripts together for a super powerful system.
This is arguably the most valuable piece of the project!
These dozens of aliases make working with Linux and developing web app software much more efficient and streamlined.
Go check it out! bash_rc.aliases
Easily add Human-readable execution time for every command in bash!
The time will show up in the bottom left, immediately left of your $PS1.
2 days 05:02:11.33 # A very long process
To Install:
curl https://raw.githubusercontent.com/hopeseekr/bash-timer/v1.5.0/install | bash
View the README.md for more information.
Automatically sets up (if needed) a SSH private key and installs it on the remote server (creating the .ssh, if needed, as well.
Properly configures your OpenSSH client and installs ssh-agent
in your ~/.bash_profile
in such a way
that you will only ever have to enter your SSH keyphrase once per login for anything that works with ssh-agent
.
A highly-optimized .gitconfig for seasoned software developers ready to increase their daly productivity. Install into ~/.gitconfig.
git pretty
git ll
Shows a beautiful multi-colored log with standard ISO dates:
git fix
Quickly jumps into rebasing the last two commits into one another.
git alterego
Quickly switch the current repo to using your main alterego account for an previously-committed commit.
git ego
The reverse of git alterego
.
git resign <hash>
Quickly resign bulk commits from to the latest.
This is particularly utilitarian when your GPG key expires and you need to renew it and then resign.
git c: checkout
git cp: cherry-pick
git cpm: cherry-pick for Merge commits
Utility aliases to make git more efficient to use.
git shows
Shows the GPG signature for every commit in git log
.
Easily bulk change the author's name and email of any of the commits in a git repository.
Usage: git-change-author "Your Name" "email@address" [SHA1]
Use a file's modified time as the git time.
Example:
$ ls -l american-date
#-rwxrwxr-x+ 1 1MB Oct 14 2020 american-date
$ ./git-commit-at-modded-time american-date
$ git pretty american-date
7462b66 G 2020-10-14 15:53:34 -0500 Theodore R. Smith
Restores each file's modification time in your working directory to when it was last updated in the remote git repository.
When you checkout a repository & run this, your workdir goes from:
-rwxrwxr-x+ 1 tsmith users 1MB Oct 22 01:58 changelog-maker-lite*
-rw-rw-r--+ 1 tsmith users 1MB Oct 22 01:58 CHANGELOG.txt
-rw-rw-r--+ 1 tsmith users 1MB Oct 22 01:58 gitconfig
-rwxrwxr-x+ 1 tsmith users 1MB Oct 22 01:58 git-mtime
To:
-rwxrwxr-x+ 1 tsmith users 1MB Oct 1 08:38 changelog-maker-lite*
-rw-rw-r--+ 1 tsmith users 1MB Oct 1 01:10 gitconfig
-rwxrwxr-x+ 1 tsmith users 1MB Sep 30 23:19 git-mtime
Unifies the GPG signature time with the commit's time.
Before:
gpg: Signature made Fri 19 Jan 2024 06:50:44 AM CST
gpg: using RSA key 4BF826131C3487ACD28F2AD8EB24A91DD6125690
gpg: Good signature from "Theodore R. Smith <[email protected]>" [ultimate]
43578ec G 2024-01-16 01:52:41 -0600 Theodore R. Smith [m] Updated the packages and exclusion lists. HEAD
gpg: Signature made Fri 19 Jan 2024 06:50:25 AM CST
gpg: using RSA key 4BF826131C3487ACD28F2AD8EB24A91DD6125690
gpg: Good signature from "Theodore R. Smith <[email protected]>" [ultimate]
8ab4104 G 2024-01-15 08:27:07 -0600 Theodore R. Smith Upgraded to PHP 8.3.
After:
gpg: Signature made Tue 16 Jan 2024 01:52:41 AM CST
gpg: using RSA key 4BF826131C3487ACD28F2AD8EB24A91DD6125690
gpg: Good signature from "Theodore R. Smith <[email protected]>" [ultimate]
515e36b G 2024-01-16 01:52:41 -0600 Theodore R. Smith [m] Updated the packages and exclusion lists. HEAD
gpg: Signature made Mon 15 Jan 2024 08:27:07 AM CST
gpg: using RSA key 4BF826131C3487ACD28F2AD8EB24A91DD6125690
gpg: Good signature from "Theodore R. Smith <[email protected]>" [ultimate]
22c5040 G 2024-01-15 08:27:07 -0600 Theodore R. Smith Upgraded to PHP 8.3.
Create tar files automatically sorted by file name.
This is particularly helpful on random-order file systems, such as ext4.
With the Bettergist Collector, we use this to be able to roughly estimate how long compressing and extracting multiple-gigabyte files with millions of files will take.
It is a drop-in replacement for tar
, and uses the same arguments.
Optionally, you can install the function directly into your ~/.bashrc.
- Empties out the ~/.cache directory of every non-root user.
- Empties out Pacman's package cache directory.
This can optionally use nullfsvfs in order to limit wear-and-tear on SSDs.
Removes every non-EN locale file every day.
This saves, usually, 400-1000 MB of space.
Takes BTRFS snapshots of / every hour on the hour.
Cleans up the prior day's hourly snapshots while keeping the daily ones.
Cleans up otherwise-useless PHP temp files, which is very useful on busy servers.
- Old session files that haven't been modified in the last hour.
- phpunit temp files.
- phpstan temp files.
A utility to print out dates in the American format
Fri, 19 January 2024 05:49:20 CST
Easily creates CHANGELOGs based upon concise git commit logs:
[2020-10-01 00:23:15 CDT] — [x265.sh] Use VAAPI for encoding using Intel graphics cards.
[2020-10-01 00:30:00 CDT] — Created a README.md.
[2020-10-01 00:37:07 CDT] — [random-file] renamed for more clarity.
[2020-10-01 00:44:34 CDT] — Flushed out the README.
[2020-10-01 00:49:44 CDT] — [bash_rc.aliases] Added a whole slew of webdev aliases.
[2020-10-01 00:58:00 CDT] — [bash_rc.aliases] Added some more descriptions.
[2020-10-01 01:10:26 CDT] — [.gitconfig] Added a whole bunch of my git aliases. tag: v1.0.0
[2020-10-01 08:17:42 CDT] — [clear-cache] Delete broken symlinks in the ~/.cache directories.
- It detects if the user is running Wayland. If so, for Chromium-based browsers, it will pass the flags necessary for it to run in native-Wayland (not XWayland) for superior performance.
- It will always launch using the Gnome Keychain, so that you won't lose all of your cookies and permanent logins every time you switch to KDE, and vice-versa.
Returns a list of files sorted by file size, descending, that are at least X MB big.
Picks a random file in a directory / PWD.
YouTube CLI Livestream Screencaster straight from the CLI (via ffmpeg)!
This will make sudo
only ask for your password ONE TIME during
a single boot. It won't ask across terminals and it won't time out.
On reboot, it will automatically expire.
Displays how many megabytes still need to be written to [slow] disks.
Every 5.0s: grep -e Dirty: -e Writeback: /proc/meminfo asus-z13: Fri Jan 19 07:09:32 2024
Dirty: 751552 kB
Writeback: 0 kB
Easily turns off all of your monitors via the CLI.
For when you want to just step away and not worry so much about a lock screen.
Installs a NetworkManager script that atomatically runs when connected to specific # WiFi networks.
Adds a watermark to videos via ffmpeg.
Transcodes to x265 HEVC via ffmpeg using Intel's graphics card.
Aids in automagically repairing duplicate Pacman database entries in Arch Linux.
It's meant to resolve the rare problem: "error: duplicated database entry 'foo'"
Shallow updates a shallow git clone --depth 1
repository.
In Arch Linux, a btrfs setup puts every single file in /. This greatly limits the ability to properly manage the system, with subvol=5 having nothing but subvolumes.
This script does the following:
- Creates new root-level snapshots:
@rootfs
(/),@snapshots
,@important
, and@home
. - Moves files
/
into/@rootfs
,/home
into/home
and creates new/snaps
and/important
. - Creates
/media/true-root
that is auto-mounted to/ (subvol=5)
. - Integrates with the
cron.d
auto-snapshot cronjobs in this project/
is snapshotted daily in `/snaps/daily/YYYY-MM-DD./important
is snapshotted hourly in/snaps/important/YYYY-MM-DD/HH
./important
is set for compression-enabled.- Sets up
/home
to quota-enforced based on 10% of the total disk space per-user, and 50% of the total disk space for every user. - The
/home
snapshot is set for compression-enabled. - The
/home
has rolling 7-day snapshotting for user's.*
files, except forcache
directories (when using [cron.daily/00_clear-cache]).
Arch Linux sticks all of / in the main BTRFS subvolume (ID=5).
This means that common snapshotting and subvolume tasks, particularly rolling back to a previously (e.g., working) root subvolume is exceptionally difficult and requires a rescue boot, etc.
The provided solution hotfixes the situation, hopefully without the need for a rescue disk, on a live environment. However, you really ought to have a rescue disk prepped in avance.
And for the love of God, make backups first!
Automagically downloads all of the GitHub repositories of a user or or an organization.
When run standalone, it will echo either "Running as root" or "Not running as root".
When called as a function, it will return either true
or false
.
Blocks the executing program until a key is pressed, the mouse is moved, or a mouse button is pressed, anywhere, irregardless of window focus.
It will echo one of the following: KEYBOARD_KEY, MOUSE_CLICKED, or MOUSE_MOVED.
Can be run either standalone or as a function.
This project is licensed under the Creative Commons Attribution License v4.0 International.
Theodore R. Smith [email protected]
GPG Fingerprint: 4BF8 2613 1C34 87AC D28F 2AD8 EB24 A91D D612 5690
CEO: PHP Experts, Inc.