Skip to content

Instantly share code, notes, and snippets.

@pgorod
pgorod / Add_WindowsDefender_Exclusions.ps1
Created November 18, 2023 10:52 — forked from dkorobtsov/Add_WindowsDefender_Exclusions.ps1
PowerShell script to add Windows Defender exclusions for WSL2 and JetBrains IDE performance issues
# PowerShell script to add Windows Defender exclusions for WSL2 and JetBrains IDE performance issues
#
# For context please read this thread:
# https://github.com/microsoft/WSL/issues/8995
#
# How to use?
# - Save the Script: Open a text editor like Notepad and paste the PowerShell script into it.
# - Save the file with a .ps1 extension, for example, Add_WindowsDefender_Exclusions.ps1.
# - Run PowerShell as Administrator: Search for "PowerShell" in the Start menu, right-click on it, and choose "Run as administrator".
# - Navigate to the Script's Location: Use the cd command to navigate to the directory where you saved the .ps1 file.
@rafaelstz
rafaelstz / Magento 2 - Remove all customer data
Last active September 21, 2024 12:14
Remove all Magento 2 test Sample Data
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE TABLE `customer_entity`;
TRUNCATE TABLE `customer_entity_datetime`;
TRUNCATE TABLE `customer_entity_decimal`;
TRUNCATE TABLE `customer_entity_int`;
TRUNCATE TABLE `customer_entity_text`;
TRUNCATE TABLE `customer_entity_varchar`;
TRUNCATE TABLE `customer_address_entity`;
TRUNCATE TABLE `customer_address_entity_datetime`;
@rohankhudedev
rohankhudedev / opcache.ini
Last active November 10, 2024 15:24
Best Zend OpCache Settings / Tuning / Configurations
[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1
; Determines if Zend OPCache is enabled for the CLI version of PHP
;opcache.enable_cli=1
; The OPcache shared memory storage size.
opcache.memory_consumption=512
@holmberd
holmberd / php-pools.md
Last active September 25, 2024 05:44
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@rafaelstz
rafaelstz / magento2-truncate.sql
Created August 29, 2017 14:40
Magento 2 truncate customers, products, reviews and orders table
SET FOREIGN_KEY_CHECKS = 0;
-- Truncate order tables
TRUNCATE TABLE `gift_message`;
TRUNCATE TABLE `quote`;
TRUNCATE TABLE `quote_address`;
TRUNCATE TABLE `quote_address_item`;
TRUNCATE TABLE `quote_id_mask`;
TRUNCATE TABLE `quote_item`;
@jcberthon
jcberthon / networkmanager-wifi-powersave.md
Last active November 17, 2024 14:54
NetworkManager Wi-Fi powersaving configuration

NetworkManager WiFi Power Saving

NetworkManager supports WiFi powersaving but the function is rather undocumented.

From the source code: wifi.powersave can have the following value:

  • NM_SETTING_WIRELESS_POWERSAVE_DEFAULT (0): use the default value
  • NM_SETTING_WIRELESS_POWERSAVE_IGNORE (1): don't touch existing setting
  • NM_SETTING_WIRELESS_POWERSAVE_DISABLE (2): disable powersave
@sergiojovanig
sergiojovanig / magento2-deploy.sh
Last active March 18, 2021 12:36
Deploy Magento 2 steps
php bin/magento setup:backup --db
gzip var/backups/*.sql
git pull
php bin/magento maintenance:enable
php bin/magento cache:enable
rm -fr var/di var/generation var/cache
php bin/magento setup:di:compile
php bin/magento deploy:mode:set production --skip-compilation
php bin/magento maintenance:enable
php bin/magento setup:upgrade
@LauLaman
LauLaman / gpg.md
Last active March 7, 2023 14:42
Use GPG to sign commits using git & PHPStorm

1 - install GPG tools : https://gpgtools.org/

2 - Create new key for your github email

3 - Add key to git on your local machine: git config --global user.signingkey YOURKEY

4 - configure git to sign all commits: git config --global commit.gpgsign true

5 - add to the bottom of ~/.gnupg/gpg.conf: (create the file if it not exists)

@dleone81
dleone81 / reindexall.sh
Created March 11, 2016 08:48
Avoid Magento
#!/bin/bash
# This file reindex all Magento indexes without any lock table
# This is the right order to reindexall via script
# I update every 3 sec any Magento product via API.
# Before this script I noticed this error
# SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction
echo "Reindexall via script"
php /mage/magento/shell/indexer.php --reindex cataloginventory_stock
php /mage/magento/shell/indexer.php --reindex catalog_product_attribute