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 / _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
@podlom
podlom / _start_prod_db_backup.sh
Last active December 18, 2023 11:19
Start prod db backup
#!/bin/bash
# Set up local and remote credentials
LOCAL_WP_PATH="/nas/content/live/asianlegacylib" # 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_prod_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 / _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 / _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_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 / _install_team_viewer.sh
Created October 12, 2023 09:16
Install TeamViewer on Ubuntu Linux 22.04
#execute the following command to make yourself as an administrator root user:
sudo su
#first install TeamViewer SSL certificates:
cd /tmp
wget https://download.teamviewer.com/download/linux/signature/TeamViewer2017.asc
sudo apt-key add TeamViewer2017.asc
sudo sh -c 'echo "deb http://linux.teamviewer.com/deb stable main" >> /etc/apt/sources.list.d/teamviewer.list'
#update system packages
@podlom
podlom / _break_lines.php
Created October 4, 2023 15:13
Break lines on two equal parts not breaking whole words
<?php
// Check if the input file exists
$inputFile = "_input_file_name.txt";
// Function to break a line into two parts, aiming for equal number of characters, without breaking words
function breakLineEqually($line) {
$length = strlen($line);
$mid = intdiv($length, 2);
@podlom
podlom / style.css
Last active September 22, 2023 15:45
Example style.css for a child WordPress CMS theme
/**
* Theme Name: landing-pagency Child
* Theme URI: https://wordpress.org/themes/landing-pagency/
* Description: landing-pagency Child Theme
* Author: Taras Shkodenko
* Author URI: https://m.shkodenko.com/
* Template: landing-pagency
* Version: 0.0.1
* License: GNU General Public License v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html