Do not follow this link

~eidolon/scripts

Random scripts that I use
Minor fixes and updated README.
Added the ,squash-merge script.
Adding a new script ,adr

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~eidolon/scripts
read/write
git@git.sr.ht:~eidolon/scripts

You can also use your local clone with git send-email.

#Random Scripts

I use these from time to time and figured they may as well be pushed. Note that there are all sorts of assumptions about my system in here. Over time I'll attempt to reduce or remove those.

#Installation

There are two types of installable artifacts: scripts and startup shell. The former are usually directly executed, and the latter might be sourced in other files. These can be installed independently. By default both will be installed to the following locations:

  • Scripts: $HOME/bin
  • Startup: $HOME/.startup
$ ./install.sh

Please use ./install.sh --help for more information and options.

#About the Scripts

#Computer Organization Notes

Some assumptions that may be baked into these scripts:

  • I install software to $HOME/opt/thing-${version} and (usually) create a symbolic link to $HOME/opt/thing.

#,mime-refresh

Downloads and parses a complete list of MIME types from IANA. Please see the IANA Media Types Listing for more information about this source.

Important notes about this script:

  • It will remove all MIME CSVs from the current directory. Please see the script for a complete list of files that will be removed.
  • It will download a complete list of MIME CSVs.
  • The output file is: mime-YYYY-mm-dd in the current directory.

Usage:

$ mime-refresh

#,browse-local-network

This is just a one-liner that I'll forget without this:

avahi-browse --all -t -r

Handy for looking up IPs of things like printers or whatever.

#,replace-all

Wrapper around ripgrep + sed for performing a global find/replace within some file hierarchy, usually a Git repository for some project. This one is actually pretty useful for quick package/import adjustments.

Usage:

Usage: replace-all <-f|--find $QUERY> <-r|--replace $LITERAL>
       [-n|--no-backup] [-v|--verbose] [-h|--help]

Perform global find/replace in the current directory hierarchy.

  -f|--find       $QUERY is used directly in `sed`, and identifies the
                  text to replace.
  -r|--replace    $LITERAL is used directly in `sed`, and will be inserted
                  literally in place of every match.
  -d|--dry-run    Perform a search and list the impacted files.
  -n|--no-backup  Do not create backup files.
  -v|--verbose    Enable verbose output. Lists impacted files.
  -h|--help       Display this usage text.

Examples:

replace-all -f com.example.foo.v0 -r com.example.foo.v1

#,update-iosevka

Performs an update of the Iosevka font.

Usage:

$ update-iosevka <version>

Note that this script is Ubuntu-specific.

#,update-zig

Performs an update of the Zig programming language. Zig is kind enough to provide a JSON digest of current builds, including nightly. This script parses that digest to install the latest nightly build, which is currently recommended.

Usage:

Usage: update-zig [-a|--arch <arch>] [-d|--dir <dir>] [-h|--help]

Update the zig to the latest dev build.

  -a|--arch    Select the specified architecture.
  -d|--dir     Select the installation directory.
               Default = $HOME/opt
  -h|--help    Display this usage text.

Examples:

update-zig -a aarch64

#,update-shellcheck

Performs an update of the Shellcheck binaries to the latest stable version.

Usage:

$ ,update-shellcheck

#,squash-merge

Assists with performing a squash merge on the command line.

Usage:

Usage: ,squash-merge [-h|--help] [-b|--base <branch>] [-d|--delete]
                     [-n|--no-push-base] [-r|--remote <remote>] <target>

Squash and merge the target branch into the base (main) branch.
By default, the base branch will be pushed to the default remote.

  -b|--base <branch> Merge to the selected branch.
                     (Default Base Branch: "main")
  -d|--delete        Delete the target branch after merging.
  -n|--no-remote     Do not take any remote actions.
  -r|--remote        Remote where the base branch will be pushed.
                     (Default Remote: "origin")
  -rb|--rebase       Rebase against the base branch.
  -q|--quiet         Suppress output.
  <target>           The branch to merge into the base branch.
  -h|--help          Display this usage text.

**Examples**

  ,squash-merge my-feature
  ,squash-merge -d my-feature
  ,squash-merge -b master -d my-feature
  ,squash-merge -d -n my-feature
Do not follow this link