Skip to content

Instantly share code, notes, and snippets.

View harshadyeola's full-sized avatar

Harshad Yeola harshadyeola

View GitHub Profile
-- delete any usermeta specific to the other subsites
delete from wp_usermeta where meta_key regexp '^wp_([0-9]+)_';
-- duplicate the wp_usermeta structure in a working data table,
-- but add a unique index for filtering out duplicates
create table _fix_usermeta like wp_usermeta;
alter table _fix_usermeta add unique(user_id, meta_key);
-- copy the site-specific usermeta, keeping only the last of each duplicate
insert into _fix_usermeta
@harshadyeola
harshadyeola / nginx-plus-fastcgi-cache.conf
Last active June 5, 2018 14:25
NGINX PLUS FASTCGI CACHE CONFIGURATION
# FastCGI cache settings
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:50m inactive=60m;
fastcgi_cache_key "$scheme://$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header updating http_500 http_503;
fastcgi_cache_valid 200 6h;
fastcgi_cache_valid 404 10m;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_param SERVER_NAME $http_host;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
#!/bin/bash
export AZURE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=https;*something here*"
AZURE_DIR="/root/azure-bh"
mkdir ${AZURE_DIR}
for container in $(azure storage container list | awk '{ print $2 }' | tail -n +5 | head -n -1)
do
IF_DOWNLOAD="$(azure storage blob list $container)"
echo "$IF_DOWNLOAD" | grep 'No blobs found'
if [ $? != 0 ]; then
#!/bin/bash
export AZURE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=https;*something here*"
AZURE_DIR="/root/azure-bh"
mkdir ${AZURE_DIR}
for container in $(azure storage container list | awk '{ print $2 }' | tail -n +5 | head -n -1)
do
IF_DOWNLOAD="$(azure storage blob list $container)"
echo "$IF_DOWNLOAD" | grep 'No blobs found'
if [ $? != 0 ]; then
#!/bin/bash
#####################################################################
# Benchmark Script 2 by Hidden Refuge from FreeVPS #
# Copyright(C) 2015 - Hidden Refuge #
# License: GNU General Public License 3.0 #
# Github: https://github.com/hidden-refuge/bench-sh-2 #
#####################################################################
# Original script by akamaras/camarg #
# Original: http://www.akamaras.com/linux/linux-server-info-script/ #
# Original Copyright (C) 2011 by akamaras/camarg #
@harshadyeola
harshadyeola / dev-ssh-keys
Created December 1, 2015 10:14
EasyEngine Team ssh public keys
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA7tDVPV0UKE9MAc+PfKiKorJc1UBppxCUYHNVTzxLSeSD9zphaoz/KXBhMXlqQO5BkAPx8BTctD1nBwEtzLr0TUfD1Y4dlJs/TPIoqtk/shFvCnFlUW0DMnUlKPMLurD9x8/Gu85UGGJRX1qeQwgx15iTPToY5P92Ik9WnruUILjiN+by5PyHCcJeihPnbSJsS9GjEcpJW5/k3pgrhMgaQDZZ0+MkLp3SAihXLnfw7pskPimosVoDXKDenAPe0SmBs/SmOXGfUrKNnQPWZHS8uYhj3nRle9A64vlNPwllaBXI+09o7McJ1ov1L2Zay1VjAwrAgVw6ZP9aOfWAgCpruw== [email protected]
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAoViSyJq64eNfp5oENTC2M3lbHKuyoReNIK9JIob0yicpWjRBtoWWhCZwdbBKgq+XYdQdget809zXNEZAhz8NqqalPz6ZN8daLsxPLVjc5ozmHmtu/K0x8pDH8+kurY0ExdlWfEYWvGCP0YQLRKg2lJc5iJCzAaDIHcd03G1b9jfmn0/PMqineDgBgz8o6teFvwMfTPAJ7PefDvP7LMjU8w0CdqIl5qBAxuRbvPL2oaTSXSBt4/qEMMFtMECx/sBZGiBpRXVaWoPnucMVuVA49cyj/z2jWKrIh8MZY8GbbwZrgPuCagM97D2GBpe3vUfewtWvuNIfbd4geq0E8crMpw== radhe@radhe-laptop
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCiXuU0L6M1cfAnNSczB7RdbNSzrWOGiMXkLVBYauE+joaIw4FComK15USkwFCJQGO95E97pSn/wUN9XWINH0WEXWLiFYRkUg1GsjSvHt08ENnPcyO+QX5/UT6YVQbIuNr8VZ2nffX/rx9vLXiSWBSPbpuunttBBzTZjd
# Know MyISAM tables list
SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'example_com' AND engine = 'MyISAM';
# Get queries to alter table engine
SET @DATABASE_NAME = 'example_com';
SELECT CONCAT('ALTER TABLE `', table_name, '` ENGINE=InnoDB;') AS sql_statements
FROM information_schema.tables AS tb
WHERE table_schema = @DATABASE_NAME
web:
build: .
command: php -S 0.0.0.0:8000 -t /code
ports:
- "8000:8000"
links:
- db
volumes:
- .:/code
db:
### http://www.cyberciti.biz/tips/linux-unix-bsd-nginx-webserver-security.html
# Avoid a smurf attack
net.ipv4.icmp_echo_ignore_broadcasts = 1
# Turn on protection for bad icmp error messages
net.ipv4.icmp_ignore_bogus_error_responses = 1
# Turn on syncookies for SYN flood attack protection
net.ipv4.tcp_syncookies = 1