Skip to content

joehcooper/.scripts

Repository files navigation

.scripts

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.

Overview

Scripts

build-dotfiles.sh

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:

  1. Cleans any previous build directory
  2. Copies public dotfiles from ~/.dotfiles
  3. Overlays private dotfiles from ~/.dotfiles-private
  4. Runs GNU Stow to symlink the merged configuration

Requirements:

  • GNU Stow
  • Public dotfiles in ~/.dotfiles
  • Private dotfiles in ~/.dotfiles-private

build-scripts.sh

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:

  1. Cleans any previous build directory
  2. Copies public scripts from ~/.scripts
  3. Overlays private scripts from ~/.scripts-private
  4. Makes all script files executable (.sh, .js, .py)
  5. Creates a unified script collection in ~/.scripts-build

Requirements:

  • Public scripts in ~/.scripts
  • Private scripts in ~/.scripts-private

db-type-from-dump.sh

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

generate-wp-salts.js

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

Installation

  1. Clone the repository to your home directory:

    git clone https://github.com/joehcooper/.scripts.git ~/.scripts
  2. Make scripts executable:

    chmod +x ~/.scripts/*.sh
  3. (Optional) Add to your PATH by adding this to your shell configuration:

    export PATH="$HOME/.scripts:$PATH"

Integration with Dotfiles

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

Requirements

  • Bash: For shell scripts (macOS/Linux)
  • Node.js: For JavaScript utilities
  • GNU Stow: For the dotfiles build script

Related Repositories

About

My personal utility scripts for development and system management.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published