Skip to content

Instantly share code, notes, and snippets.

View krasnuydyx's full-sized avatar

Andrii Danyliuk krasnuydyx

View GitHub Profile
#You can pull this off using mysqldump. Here the catch: You cannot ship the data because there may be a cost associated with shipping the data.
#For this example, let's says you want to rename mydb to ourdb
#STEP 01 : Create the new database
mysql> CREATE DATABASE ourdb;
#STEP 02 : Get schema without the triggers
mysqldump -hrdshost -uuser -ppassword -d -t -R --skip-triggers mydb > /tmp/schema.sql
#STEP 03 : Get the triggers
@krasnuydyx
krasnuydyx / sync.sh
Last active December 29, 2020 13:50
Environment sync (Magento Cloud)
#!/usr/bin/env bash
PROD_ENV="ent-tx3iahfl3v2uk-production-vohbr3y@ssh.us-3.magento.cloud"
STAGE_ENV="ent-tx3iahfl3v2uk-staging-5em2ouy@ssh.us-3.magento.cloud"
INT_ENV="tx3iahfl3v2uk-integration-5ojmyuq--mymagento@ssh.us-3.magento.cloud"
TIMEFORMAT=%R
db_data_reg="cat app/etc/env.php | grep -A 10 \"'db'\""
try() {
"$@" || { echo "command failed, with exit code $?"; exit 1; }
@krasnuydyx
krasnuydyx / backup.sh
Created March 29, 2019 16:35
Simple backup script
#!/bin/bash
## Configuration
SRC_CODE="/var/jenkins_home"
BACKUP_DIR="/home/ec2-user/"
PROJECT_NAME="jenkins-vfqa"
DST_HOST="user@host"
REMOTE_DST_DIR="/root/backup"
EXCLUDES="-x '*/workspace/*' '*/jobs/*/builds/*' '*/jobs/*/lastStable/*' '*/jobs/*/lastSuccessful/*'"
BACKUP_DAILY=true # if set to false backup will not work
@krasnuydyx
krasnuydyx / certbot-cloudfront.sh
Created April 30, 2019 18:15
certbot-cloudfront.sh
#!/usr/bin/env bash
AWS_ACCESS_KEY_ID="ARICICnfC3274R522L6F" \
AWS_SECRET_ACCESS_KEY="qLwaE0s7m/LrfP+" \
certbot --agree-tos -a certbot-s3front:auth \
--certbot-s3front:auth-s3-bucket sdfnowier \
--certbot-s3front:auth-s3-region us-east-2 \
-i certbot-s3front:installer \
--certbot-s3front:installer-cf-distribution-id EFGQREDSAF \
-d site.com -d www.site.com
awk -vDate=`date -d'now-2 hours' +[%Y-%m-%dT%H:%M:%S` '$4 > Date {print $1}' access.log | sort | uniq -c | sort -n | tail