Janderscripts
February 1, 2025 ยท View on GitHub
Janderscripts
Gather small helpers and scripts, in different languages, mostly for personal usage, but who knows, there might be something for you in there.
About the scripts:
- They should be glue scripts i.e. not use too much intricate logic, but serve as glueing a few specific commands and utils together.
- They should come with a fair amount of unit- and integration-tests.
- They should be structured enough for a non script expert to understand.
- If growing, or beneficial in a more general sense, make no mistake - they should be obsoleted, and rewritten in a more robust language. Even better - be submitted as a PR to any relevant project where the overall function itself would feel at home.
Currently Maintained Script Descriptions
Bash
bash/src/dirsumgen.bash- A wrapper for the creating md5 and sha256 sums for directory trees. One of each for each dir.bash/src/export_gpg.sh- A script which exports your GPG private-, public keys and owner trust data (to a directory with locked down permissions).bash/src/git_test_create_tbc.sh- A script which creates git test data in a repository: branches, tags, commits.bash/src/git_delete_branch_local_with_no_remote.sh- A script which deletes all local branches having no tracking branch upstreams.bash/src/github_cleanup_helper.sh- A script which allows you to clean workflow runs, caches or deployments on GitHub.
Dependencies
Bash
General Usage
./bash/src/<script>.bash -h
Usage
- Clone this repo
git@github.com:janderssonse/janderscripts.git
SCRIPT: export_gpg
A script which exports your private keys, public keys and owner trust data (to a directory with locked down permissions).
I use it with YADM handle encryption/decryption of the export, and easily move between environments.
YADM-usage:
Put a pattern of .gnupg/.exported-keyring/* into .config/yadm/config and use YADM encrypt/decrypt.
Importing the keys to a new location
$ gpg --import "$HOME/.gnupg/.exported-keyring"/*.asc
$ gpg --import-ownertrust "$HOME/.gnupg/.exported-keyring"/ownertrust.txt
Development
Test and code style
Bash
Running the bash tests
Install bats-core with support libs.
- To Install the Bats-core dependencies where the bats scripts can find them (
/bash/lib):
./bash/install_bats.bash
- To run the tests:
./bash/lib/bats/bin/bats bash/src/test
- Run a script:
./bash/src/<script>.bash -h
Getting involved
See CONTRIBUTING.
License
Scripts in this project are licensed under the MIT LICENSE.
Credits
The Bats project - for making us create robust Bash-scripts.