This file contains 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
###################################################################### | |
## Word to the wise ## | |
## It is best to keep your htaccess files as clean as possible ## | |
## and set as many specs in your Apache config as you can. ## | |
## Htaccess slows down Apache. ## | |
## Review the entire file before use, especially the TODO sections. ## | |
###################################################################### | |
Options -MultiViews | |
Options +FollowSymLinks |
This file contains 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
## Split large SQL files into separate files for each table if every tabel starts with a 'DROP TABLE IF EXISTS' statement | |
csplit -k $PWD/filename.sql '/^DROP TABLE IF EXISTS .*/' '{900}' | |
## Split large SQL files into separate files for each table if every tabel starts with a 'CREATE TABLE' statement | |
csplit -k $PWD/filename.sql '/^CREATE TABLE .*/' '{900}' |
This file contains 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
# Get available disk space | |
df -h | |
# Get the top 10 biggest folders in the current directory | |
du -h --max-depth=1 | sort -rh | head -10 | |
# Get the top 10 biggest folders in the current directory and their first child directories | |
du -h --max-depth=2 | sort -rh | head -10 | |
# Get sizes of all folders in the current directory |
This file contains 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
#!/usr/bin/env bash | |
# Magento 2 Deployment Script | |
# Author: Joost van Veen | |
usage="$(basename "$0") [-h] source-directory destination-directory folders-to-sync files-to-sync | |
Rsync folders and files from one folder to another | |
where: | |
-h show this help text |
This file contains 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
## NOTE: when finding file by time, use one of the following flags: | |
# ctime : the time a file was changed, in hours. On most systems this timestamp cannot be altered by any user, so it is fairly reliable | |
# atime : the time a file was last accessed, in hours. This is also set by the system. | |
# mtime : the modified time of a file, in hours. This can be set by any user. So if you are looking for mailcious files, never use this flag. | |
# cmin : same as mtime, but in minutes. | |
# amin : same as atime, but in minutes. | |
# mmin : same as mtime, but in minutes. | |
# Find all files in current directory changed more than 8 hours ago (480 minutes) | |
find $PWD -mindepth 1 -type f -cmin +480 |
This file contains 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
## Reindex catalogrule prices in Magento 2 | |
## Navigate to Magento root, e.g.: | |
cd ~/magento2 | |
## Reindex the catalogrule prices | |
php bin/magento indexer:reindex catalogrule_product | |
## For this indexer to correctely index the new productprices, the | |
## catalogrules need to be indexed first. This usually happens |
This file contains 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
-- | |
-- This query delelets all customers and orders from your | |
-- Magento 1.* install. Handy, if you have a bloated | |
-- Magento database and you need to do a bit | |
-- of cleaning up for use on a local machine. | |
-- | |
-- Replace PREFIX_ with your current Magento table prefix. | |
-- | |
-- USE AT OWN RISK. ALWAY BACKUP YOUR DATABASE FIRST. | |
-- |
This file contains 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
## eval() is used to executed shell commands through PHP | |
grep -ri "eval(" $PWD --include *.php | |
## exec() is used to executed shell commands through PHP | |
grep -ri "exec(" $PWD --include *.php | |
## Malicious code is often obfuscated through base64 encoding | |
grep -ri "base64" $PWD --include *.php | |
## Malicious code is often obfuscated through gzip |
This file contains 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
# Force SSL, but only for a certain domain | |
# At the same time, redirect http non-www ad www to https://www | |
# Replace example\.com and example.com with your domain | |
RewriteCond %{HTTPS} off | |
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ | |
RewriteRule (.*) https://www.example.com/$1 [R=301,L] |
This file contains 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
-- Orders with more than one shipment | |
SELECT orders.increment_id AS ordernummer, orders.created_at, count(*) as `Aantal verzendingen` FROM sales_shipment as shipments | |
LEFT JOIN sales_order AS orders ON orders.entity_id = shipments.order_id | |
GROUP BY shipments.order_id | |
HAVING `Aantal verzendingen` > 1 | |
ORDER BY orders.created_at; | |
-- Orders with more than 1 invoice | |
SELECT orders.increment_id AS ordernummer, orders.created_at, count(*) as `Aantal facturen` FROM sales_invoice as invoices | |
LEFT JOIN sales_order AS orders ON orders.entity_id = invoices.order_id |
NewerOlder