The idea here is super simple - check how much is current attribute used and decide which can be removed from the shop to increase the performance and/or reduce database load. Script might be quite heavy to run at once, thus consider splitting it in two by commenting out some left joins and corresponding count selects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Sitewards\SyncURLs\Console\Command; | |
use \Symfony\Component\Console\Command\Command; | |
use \Symfony\Component\Console\Input\InputInterface; | |
use \Symfony\Component\Console\Output\OutputInterface; | |
use \Magento\Framework\App\Config\ConfigResource\ConfigInterface; | |
use \Magento\Store\Model\StoreManagerInterface; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am aboritskiy on github. | |
* I am aboritskiy (https://keybase.io/aboritskiy) on keybase. | |
* I have a public key ASA1HtFaV9H65HO0wuDSigZpBchwDzkQAecJV0FRA0AHvQo | |
To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql -u root -p --execute="SET GLOBAL innodb_fast_shutdown=0" | |
mysqladmin -u root -p shutdown | |
sudo yum remove mysql55\* | |
sudo yum install mysql56-server | |
sudo service mysqld start | |
sudo mysql_upgrade -u root -p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteRule ^/\. - [L,R=403] | |
RewriteRule ^/app/ - [L,R=403] | |
RewriteRule ^/dev/ - [L,R=403] | |
RewriteRule ^/downloader/ - [L,R=403] | |
RewriteRule ^/includes/ - [L,R=403] | |
RewriteRule ^/lib/ - [L,R=403] | |
RewriteRule ^/shell/ - [L,R=403] | |
RewriteRule ^/pkginfo/ - [L,R=403] | |
RewriteRule ^/var/ - [L,R=403] | |
RewriteRule ^/rss/ - [L,R=403] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
yum update -y | |
yum install -y httpd | |
echo "<VirtualHost *:80> | |
ServerName default | |
ServerAdmin [email protected] | |
DocumentRoot /var/www/html/ | |
<Directory '/var/www/html/'> | |
Options FollowSymLinks Includes ExecCGI | |
AllowOverride All |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT table_schema as `Database`, table_name AS `Table`, | |
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` | |
FROM information_schema.TABLES | |
WHERE table_schema = "PUT-YOUR-DB-NAME-HERE" | |
ORDER BY (data_length + index_length) DESC; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SUBMODULES_LIST=$(git submodule status | awk '{print $2}'); | |
echo "Status before:" | |
echo | |
git submodule status | |
echo | |
for SUBMODULE_PATH in $SUBMODULES_LIST |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
AWS_ACCOUNT_ID=657433956652 | |
echo "Snapshots exist for following images: " | |
aws ec2 describe-snapshots --filters Name=description,Values="Created by CreateImage*" --owner-id=$AWS_ACCOUNT_ID --output=text | grep "^SNAPSHOTS" | sed 's/.*\(ami-[0-9a-z]\+\).*/\1/' | sort | uniq | sort > /tmp/snapshot-cleanup-existing-snapshots |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TOKEN="" | |
curl "https://slack.com/api/channels.list?token=$TOKEN&exclude_archived=true&pretty=1" > /tmp/channels.list | |
IDS=$(cat /tmp/channels.list | jq '.channels[] | select(.num_members == 0) | .id' | sed -e 's/"//g') | |
for ID in $IDS; do | |
CHANNEL_DATA=$(cat /tmp/channels.list | jq ".channels[] | select(.id == \"$ID\") | \"\(.id) \(.name) \(.num_members)\"") | |
echo "$CHANNEL_DATA" | |
read -p " proceed? " -n 1 -r | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
echo " archiving..." |
OlderNewer