My personal utility scripts for development and system management.
These scripts automate common tasks in my workflow - from managing dotfiles to database operations and WordPress development. Feel free to use what's helpful, but make sure to adapt them to your specific setup and needs.
- build-dotfiles.sh: Merge public and private dotfiles before stowing
- build-scripts.sh: Merge public and private scripts into a unified directory
- db-type-from-dump.sh: Detect database type and version from dump files
- generate-wp-salts.js: Generate secure WordPress authentication salts
Merges public and private dotfiles repositories and applies them using GNU Stow.
Purpose: Combines configuration files from both public (.dotfiles
) and private (.dotfiles-private
) repositories, then symlinks them to your home directory.
Usage:
~/.scripts/build-dotfiles.sh
What it does:
- Cleans any previous build directory
- Copies public dotfiles from
~/.dotfiles
- Overlays private dotfiles from
~/.dotfiles-private
- Runs GNU Stow to symlink the merged configuration
Requirements:
- GNU Stow
- Public dotfiles in
~/.dotfiles
- Private dotfiles in
~/.dotfiles-private
Merges public and private script repositories into a unified directory.
Purpose: Combines utility scripts from both public (.scripts
) and private (.scripts-private
) repositories, making them available in a single location with proper permissions.
Usage:
~/.scripts/build-scripts.sh
What it does:
- Cleans any previous build directory
- Copies public scripts from
~/.scripts
- Overlays private scripts from
~/.scripts-private
- Makes all script files executable (
.sh
,.js
,.py
) - Creates a unified script collection in
~/.scripts-build
Requirements:
- Public scripts in
~/.scripts
- Private scripts in
~/.scripts-private
Analyzes database dump files to identify the database type and version.
Purpose: Quickly determine what type of database a dump file came from without having to manually inspect the file contents.
Usage:
~/.scripts/db-type-from-dump.sh <dump_file>
~/.scripts/db-type-from-dump.sh mydatabase.sql
Supported databases:
- MySQL (with version detection)
- MariaDB (with version detection)
- PostgreSQL (with version detection)
- MongoDB (with version detection)
Example output:
Database Type: MySQL
Version: 8.0.33
Generates secure WordPress authentication salts and keys.
Purpose: Creates cryptographically secure salts for WordPress wp-config.php
files, replacing the need to visit the WordPress.org salt generator.
Usage:
# Generate as environment variables (default)
~/.scripts/generate-wp-salts.js
# Generate as PHP define statements
~/.scripts/generate-wp-salts.js --format=php
# Generate as environment variables (explicit)
~/.scripts/generate-wp-salts.js --format=env
Output formats:
Environment variables (--format=env
):
AUTH_KEY='your-64-character-salt-here'
SECURE_AUTH_KEY='your-64-character-salt-here'
...
PHP defines (--format=php
):
define('AUTH_KEY', 'your-64-character-salt-here');
define('SECURE_AUTH_KEY', 'your-64-character-salt-here');
...
Requirements: Node.js
-
Clone the repository to your home directory:
git clone https://github.com/joehcooper/.scripts.git ~/.scripts
-
Make scripts executable:
chmod +x ~/.scripts/*.sh
-
(Optional) Add to your PATH by adding this to your shell configuration:
export PATH="$HOME/.scripts:$PATH"
These scripts are designed to work with my .dotfiles
setup. The build-dotfiles.sh
script is specifically referenced in the dotfiles README and provides the workflow for managing both public and private configuration files.
If you're using my dotfiles setup, you can use the custom script
alias to run these scripts from anywhere:
# This alias is defined in .oh-my-zsh/custom/aliases.zsh
script build-dotfiles.sh
script db-type-from-dump.sh mydatabase.sql
script generate-wp-salts.js --format=php
- Bash: For shell scripts (macOS/Linux)
- Node.js: For JavaScript utilities
- GNU Stow: For the dotfiles build script
.dotfiles
: Public dotfiles and configuration.dotfiles-private
: Private dotfiles (themes, credentials, etc.)