My collection of shell functions and configuration files for WordPress development.
dotfiles/
├── shell/
│ ├── cloudflare.sh # Cloudflare zone management (cf-opt, cf-check)
│ ├── config.sh # Global configuration management
│ ├── deployment.sh # Theme deployment (firstdeploy, depto)
│ ├── git.sh # Git utilities and branch management
│ ├── utils.sh # System utilities and common aliases
│ ├── wp-core.sh # WordPress WP-CLI shortcuts and aliases
│ ├── wp-db.sh # All database operations (pullprod, dmcweb, wp_db_optimise, etc.)
│ ├── wp-diagnostics.sh # Troubleshooting (wp_plugin_diags)
│ └── wp-uploads.sh # Upload/file sync operations (getups, pushups)
├── .gitignore
└── README.md
This dotfiles system uses a centralized configuration approach that keeps sensitive information secure while maintaining full functionality:
shell/config.sh- Central configuration manager with safe defaults.dotfiles-config- Your personal settings file (git-ignored for security)- Automatic loading - Functions load config when needed, no manual setup required
- All sensitive values (passwords, hostnames, API keys) are stored in
.dotfiles-config - This file is git-ignored so it never gets committed to the public repository
- Other users get safe defaults and can create their own personal configuration
- You keep full functionality with your actual credentials
Each function automatically loads configuration when called:
load_dotfiles_config 2>/dev/null || true # Safe loading pattern-
Clone this repository:
cd ~ git clone git@github.com:davemac/dotfiles.git
-
Create symbolic link to your home directory:
ln -s ~/dotfiles/shell ~/.shell-functions
-
Add loading code to your shell config (choose your shell):
For zsh (~/.zshrc):
# Load shell functions (interactive features) for file in ~/.shell-functions/*.sh; do source "$file" done
For bash (~/.bashrc):
# Load shell functions for file in ~/.shell-functions/*.sh; do source "$file" done
-
Reload your shell:
source ~/.zshrc # or ~/.bashrc
-
Create your personal configuration:
dotfiles_config --create # Creates .dotfiles-config in repo root dotfiles_config --edit # Edit your personal settings
-
Get started:
listcmds # View all available commands organised by category
After installation, you'll want to customise your .dotfiles-config file with your actual values:
DEV_WP_PASSWORD- Your preferred WordPress development passwordSSH_PROXY_HOST- Your SSH proxy server hostnameWC_HOSTS- Your WooCommerce production server aliasesDEV_PLUGINS_ACTIVATE- Plugins to activate locally after DB pullPROD_PLUGINS_DEACTIVATE- Production-only plugins to deactivate locallySTAGING_PLUGINS_DELETE- Dev plugins to remove on staging deploysSTAGING_DOMAIN- Staging domain suffix (default: dmctest.com.au)- And other personal settings...
Central configuration system that manages all dotfiles settings securely:
dotfiles_config --create: Create your personal configuration filedotfiles_config --show: Display current configuration settings and valuesdotfiles_config --edit: Edit configuration file with your default editordotfiles_config --help: Show detailed configuration helpload_dotfiles_config: Load configuration (used automatically by functions)
Tools for managing Cloudflare zone settings:
Optimisation:
cf-opt: Apply performance and security optimisations (interactive)cf-opt DOMAIN: Non-interactive batch modecf-opt DOMAIN SITE_PATH: Batch mode with logging
Verification:
cf-check: Check current Cloudflare settings and test cache headerscf-help: Show detailed help and usage examples
What cf-opt configures:
- Performance: HTTP/3, Early Hints, Tiered Cache, Auto Minify, 0-RTT
- Security: SSL Full (Strict), TLS 1.3, Min TLS 1.2, HTTPS Rewrites
- Cache Rules: Static assets, CSS/JS/fonts, images, WooCommerce bypass
Configuration:
- Requires
CF_API_TOKENin.dotfiles-config - Token needs: Zone Settings, Cache Rules, Cache Purge, Argo Smart Routing permissions
Essential WP-CLI aliases and shortcuts:
updatem: Update all plugins, themes, and WordPress coresiteurl: Display current site URL from databaseplugincheck: Check for plugin conflictsonetimeinstall: Install one-time login plugin on productiononetimeadmin: Generate one-time login link for admin
All database-related functions consolidated:
Database Sync Functions:
pullprod: Pull production database to local environment (full sync with--yes/-yflag)pullstage: Pull staging database to local environmentpushstage: Push local database to staging environmentpulldb: Export production database to timestamped local file
User Management:
dmcweb [user]: Update user password to configured dev password (defaults to first admin)
Multi-Host Operations:
update-wc-db: Update WooCommerce database on multiple configured hosts
Database Optimisation:
wp_db_optimise [options]/wpopt: Comprehensive database cleanup and optimisationwp_db_table_delete [options]/wpdel: Interactive database table cleanup
File sync operations between environments:
getups: Sync WordPress uploads directory from remote (l/s,-week/-latest)pushups: Push uploads to remote server (-auto,-target)
Tools for debugging WordPress issues:
wp_plugin_diags: Systematically test plugins to isolate fatal errors
Deployment automation:
firstdeploy: Initial site deployment to stagingfirstdeploy-prod: Initial site deployment to productiondepto: Deploy theme files to staging or production
Version control workflow and convenient aliases:
new_branch: Create new branch from ticket ID and titlegs: Git status (alias)ga: Git add (alias)gca: Git commit all (alias)gc: Git commit (alias)gl: Formatted git log with graph, dates, and decoration
General system tools and productivity functions:
listcmds: Display all available commands and functions in a neat table
File System Utilities:
showsize: Display directory sizes (alias: du -sh ./*)dsclean: Delete all .DS_Store files recursivelyls: Enhanced ls with colours and details (alias)up [N]: Move up N directories in the filesystem
Network Utilities:
myip: Display your public IP addresssocksit: Create SSH SOCKS proxy (uses configured SSH_PROXY_HOST)chromeproxy: Launch Chrome with SSH SOCKS proxyflushdns: Flush DNS cache and announce completion
Development Tools:
zp: Edit ~/.zprofile in Cursor (alias)sshconfig: Edit ~/.ssh/config in Cursor (alias)code: Open files in VSCode with proper setuptb: Send text to termbin.com (alias)
Homebrew Utilities:
brewup: Update Homebrew packages (alias)brewupc: Update Homebrew packages and cleanup (alias)
Media Download Tools:
ytaudio [URL]: Download YouTube audio as MP3download_vimeo_hd/dlvimeo: Download all Vimeo videos from a page in HD with metadata
Sync uploads from live site:
cd ~/Sites/yoursite
getups l # Sync all uploads
getups l -latest # Sync only last 2 months
getups l -week # Sync only last 7 daysPush uploads to staging:
pushups -auto -target s # Auto-detect site and push to stagingPull production database:
cd ~/Sites/yoursite
pullprod # Interactive confirmation
pullprod --yes # Skip confirmationOptimise local database:
wp_db_optimise # Or use alias: wpoptClean up database tables:
wp_db_table_delete # Or use alias: wpdelDownload Vimeo videos from a lesson page (HD with source URL metadata):
dlvimeo https://example.com/lesson-page/Test for plugin conflicts:
cd ~/Sites/yoursite
wp_plugin_diags # Systematically test each pluginDeploy theme to staging:
cd ~/Sites/yoursite/wp-content/themes/yoursite
depto -auto -target stagingOptimise a Cloudflare zone interactively:
cf-opt # Prompts for zone selection and confirmationsOptimise in batch mode (non-interactive):
cf-opt example.com.au # No logging
cf-opt example.com.au ~/Sites/example # With logging to site directoryCheck current settings:
cf-check # View settings and test cache headersCreate new feature branch:
new_branch IR-123 "add new feature" # Creates feature/IR-123-add-new-featureList all available commands:
listcmds # Display comprehensive list of all functions and aliases- macOS
- Homebrew
- WP-CLI
- Git
- SSH access to deployment servers
- jq (for Cloudflare functions:
brew install jq)
~/
├── .shell-functions -> ~/dotfiles/shell/ # Symlink to shell functions
└── dotfiles/
├── shell/
│ ├── cloudflare.sh # Cloudflare zone management
│ ├── config.sh # Central configuration system
│ ├── deployment.sh # Theme deployment functions
│ ├── git.sh # Git utilities
│ ├── utils.sh # System utilities
│ ├── wp-core.sh # WordPress shortcuts
│ ├── wp-db.sh # Database operations
│ ├── wp-diagnostics.sh # Troubleshooting
│ └── wp-uploads.sh # File sync operations
├── .dotfiles-config # Your personal settings (git-ignored)
├── .gitignore # Includes .dotfiles-config
└── README.md
~/.shell-functions/- Symlink that makes all functions available in your shell.dotfiles-config- Contains your personal/sensitive configuration values.gitignore- Ensures.dotfiles-configis never committed to git
To update the functions:
cd ~/dotfiles
git pullNo additional steps needed! The symbolic link ensures you always use the latest files.
- Your
.dotfiles-configfile will never be overwritten during updates - New configuration options may be added - run
dotfiles_config --showto see available settings - Functions automatically load the latest configuration when called
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request