A collection of useful bash and python scripts. This README provides an overview of each script's purpose and usage.
Parses Apache access.log files and outputs the number of requests per minute or hour.
Usage:
apachelog-digest.sh access.log # Count by minute
apachelog-digest.sh access.log hour # Count by hour
Measures response times for a URL with and without cache (using Magento's no_cache parameter).
Usage:
benchmark-url.sh "https://www.example.com/"
Runs bundle exec commands with a different database for each git branch, using the branch name as the database name (if Rails' database.yml
is configured accordingly).
Usage:
bundle-exec.sh rails c
Extracts lines between two search terms in a file and outputs them to STDOUT.
Usage:
excerpt.sh access.log "26/Jun/2019:17" "26/Jun/2019:21" > excerpt.log
Creates a fixup commit for a selected commit and automatically squashes it using interactive rebase.
Usage:
fixup # Interactive selection of commit to fixup
Rails runner script that scans all Ruby files in a Rails repository, collects referenced constants, and checks if they are defined according to Rails autoloading and Ruby constant resolution rules.
Usage:
./missing-constants # Run in a Rails project directory
Opens the current git repository in GitLab with the selected branch. Optionally opens a specific file.
Usage:
open-in-gitlab.sh # Open current directory in GitLab
open-in-gitlab.sh file.rb # Open specific file in GitLab
Checks if a password has been compromised by querying the Have I Been Pwned API.
Usage:
python3 pwnedpass.py # Will prompt for password input
Interactively rebases on the parent commit of the one selected using fzf for selection.
Usage:
rebase-interactive # Interactive selection of commit
Rebases the current branch onto a selected branch, starting from the parent of a selected commit.
Usage:
rebase-onto # Interactive selection of branch and commit
Creates a git worktree in a directory above the current repository, named after the repository and branch.
Usage:
worktree-add feature-branch # Creates ../repo-name-feature-branch
Continuously executes the command passed to it in an infinite loop. Useful for retrying commands that might fail intermittently.
Usage:
retry some-command arg1 arg2 # Runs 'some-command arg1 arg2' repeatedly
The file requirements.txt
contains the libraries required by the Python scripts.