Skip to content

Instantly share code, notes, and snippets.

View podlom's full-sized avatar
💻
Working from home

Taras Shkodenko podlom

💻
Working from home
View GitHub Profile
@podlom
podlom / _start_stage_to_prod_sync.sh
Last active November 6, 2023 14:58
Start prod to stage sync
#!/bin/bash
# Set up local and remote credentials
LOCAL_WP_PATH="/home/wpe-user/sites/asianlegacystg" # Change to your WordPress directory path
LOCAL_UPLOADS_PATH="${LOCAL_WP_PATH}/wp-content/uploads" # Local uploads directory path
DB_BACKUP_PATH="/home/wpe-user/sites/asianlegacystg/wp-content/_db_backups" # Local backup directory
DB_RESTORE_REMOTE_PATH="/home/wpe-user/sites/asianlegacystg/wp-content/_db_backups/nas/content/live/asianlegacylib/wp-content/_db_backups"
DB_BACKUP_NAME="_wp_stage_backup_$(date +%F_%H-%M-%S).sql" # Backup file name with a timestamp
TAR_BACKUP_NAME="${DB_BACKUP_NAME}.tar.bz2"
@podlom
podlom / _update_prod_to_stage_option_urls.sql
Created November 6, 2023 14:36
Update prod to stage option_urls
update `wp_options` set `option_value` = REPLACE(`option_value`, 'https://asianlegacylibrary.org', 'https://asianlegacystg.wpengine.com');
update `wp_62eed17a57_options` set `option_value` = REPLACE(`option_value`, 'https://asianlegacylibrary.org', 'https://asianlegacystg.wpengine.com');
@podlom
podlom / _sync_uploads_from_prod_to_stage.sh
Last active November 22, 2023 13:55
Sync WP uploads from prod to local and then to staging server
#!/bin/bash
# Define server addresses and directories
STAGING_SERVER="user@staging-server-address"
PROD_SERVER="user@production-server-address"
REMOTE_DIR="/path/to/staging/dir/"
LOCAL_DIR="/path/to/local/dir/"
PROD_DIR="/path/to/production/dir/"
@podlom
podlom / _sync_uploads_from_stage_to_prod.sh
Created November 22, 2023 13:54
Sync WP uploads from staging to local and then to prod server
#!/bin/bash
# Define server addresses and directories
STAGING_SERVER="user@staging-server-address"
PROD_SERVER="user@production-server-address"
REMOTE_DIR="/path/to/staging/dir/"
LOCAL_DIR="/path/to/local/dir/"
PROD_DIR="/path/to/production/dir/"
@podlom
podlom / _start_stage_db_backup.sh
Created December 5, 2023 14:57
Start stage db backup
#!/bin/bash
# Set up local and remote credentials
LOCAL_WP_PATH="/nas/content/live/asianlegacystg" # Change to your WordPress directory path
LOCAL_UPLOADS_PATH="${LOCAL_WP_PATH}/wp-content/uploads" # Local uploads directory path
DB_BACKUP_PATH="${LOCAL_WP_PATH}/wp-content/_db_backups" # Local backup directory
DB_BACKUP_NAME="_wp_stage_backup_$(date +%F_%H-%M-%S).sql" # Backup file name with a timestamp
TAR_BACKUP_NAME="${DB_BACKUP_NAME}.tar.bz2" # Tar Backup file name with a timestamp
@podlom
podlom / _change_mp3_speed.sh
Created January 4, 2024 16:46
Change mp3 files speed (speed up or slow down audio files)
#/bin/sh
speed="1.15"
mkdir "speed-${speed}x"
for f in *.mp3
do ffmpeg -i "$f" -filter:a "atempo=${speed}" "./speed-${speed}x/$f"
done