Skip to content

Instantly share code, notes, and snippets.

View ppcdias's full-sized avatar
🎯
Focusing

Pedro Dias ppcdias

🎯
Focusing
View GitHub Profile
@ppcdias
ppcdias / exim-filter-spam.sh
Created June 27, 2024 18:55
Exim Custom Filter for Identifying Specific Words in Spam Emails
# Custom Filter for Identifying Specific Words in Emails
# This filter blocks emails containing certain spam-related keywords.
# Exim filter to match specific words in the email body text
# (?i) makes the match case insensitive
if $body_text matches "(?i)Viagra|pussy|sex|sexy|****|porno|girlfriend|keylogger|Cialis|hacked|garantie|sexual|Levtira|antiviruses|bored|sexo|pornografia|hackeado"
then
# Block the email with a custom message
fail text "Mensagem bloqueada devido à nossa política anti-spam."
# Mark the message as processed and stop further filtering
@ppcdias
ppcdias / cpanel.sh
Created June 18, 2024 16:49
WHM/cPanel Useful Terminal Commands for Managing and Optimizing Server
# List All error_log Files
find /home/*/public_html -type f -name error_log -exec du -sh {} \;
# Clear All error_log Files
find /home/*/public_html -type f -iname error_log -delete
# Import a .sql File into a MySQL Database
mysql -u root -p dbname < /home/username/database.sql
# Get a List of the Most Frequent IP Addresses in Apache Logs
@ppcdias
ppcdias / laravel-artisan.sh
Created October 17, 2023 17:48
PHP Laravel Artisan Useful CLI/SSH Commands List
# laravel clear cache
php artisan config:clear
php artisan cache:clear
php artisan view:clear
php artisan route:clear
php artisan optimize:clear
@ppcdias
ppcdias / woocommerce-select2-selectwoo-remove
Created August 23, 2022 20:33 — forked from ontiuk/woocommerce-select2-selectwoo-remove
Woocommerce Remove Select2 / SelectWoo
// Add to your theme's functions.php file. De-queues Select2 styles & scripts. Useful to keep Boostrap form control formatting
/**
* Remove Woocommerce Select2 - Pre WC 3.2.1-ish
*/
function woo_dequeue_select2() {
if ( class_exists( 'woocommerce' ) ) {
wp_dequeue_style( 'select2' );
wp_deregister_style( 'select2' );
@ppcdias
ppcdias / extend-the-file-system-of-ebs-volumes.md
Last active August 15, 2021 03:43
Extend a Linux file system after resizing a volume - Amazon Elastic Compute Cloud

Extend the file system of NVMe EBS volumes

For this example, suppose that you have an instance built on the Nitro System, such as an M5 instance. You resized the boot volume from 8 GB to 16 GB and an additional volume from 8 GB to 30 GB. Use the following procedure to extend the file system of the resized volumes.

To extend the file system of NVMe EBS volumes

  1. Connect to your instance.

  2. To verify the file system for each volume, use the df -hT command.

@ppcdias
ppcdias / woocommerce-custom-redirects.php
Created March 13, 2021 19:04
WooCommerce Custom Redirect After Login/Logout/Registration
<?php
// Add the following code to the functions.php file of your child theme
/**
* WooCommerce Custom Redirect After Login
*/
add_action('woocommerce_login_redirect', 'custom_redirect_after_login');
function custom_redirect_after_login() {
$redirect = get_permalink(wc_get_page_id('myaccount'));
@ppcdias
ppcdias / select-estados-brasileiros.html
Last active June 15, 2024 18:38
Select com todos os estados brasileiros para HTML ou Contact Form 7
<!-- Versão Estado e UF para Contact Form 7 -->
[select* estado first_as_label "Selecione o estado" "Acre (AC)" "Alagoas (AL)" "Amapá (AP)" "Amazonas (AM)" "Bahia (BA)" "Ceará (CE)" "Distrito Federal (DF)" "Espírito Santo (ES)" "Goiás (GO)" "Maranhão (MA)" "Mato Grosso (MT)" "Mato Grosso do Sul (MS)" "Minas Gerais (MG)" "Pará (PA) " "Paraíba (PB)" "Paraná (PR)" "Pernambuco (PE)" "Piauí (PI)" "Rio de Janeiro (RJ)" "Rio Grande do Norte (RN)" "Rio Grande do Sul (RS)" "Rondônia (RO)" "Roraima (RR)" "Santa Catarina (SC)" "São Paulo (SP)" "Sergipe (SE)" "Tocantins (TO)"]
<!-- Versão somente UF para Contact Form 7 -->
[select* estado first_as_label "Selecione o estado" "AC" "AL" "AP" "AM" "BA" "CE" "DF" "ES" "GO" "MA" "MT" "MS" "MG" "PA" "PB" "PR" "PE" "PI" "RJ" "RN" "RS" "RO" "RR" "SC" "SP" "SE " "TO"]
<!-- Versãoe Estado e UF para HTML -->
<select id="estado" name="estado">
<option value="Selecione seu estado" selected disabled>Selecione seu estado</option>
<option value="Acre (AC)">Acre (AC)</option>
@ppcdias
ppcdias / magento2-disable-unused-modules.sh
Last active May 19, 2024 07:42
Magento 2.4 Disable Unused Modules to Increase Performance
# magento 2 disable unused modules
bin/magento module:disable Vertex_AddressValidation
bin/magento module:disable Vertex_AddressValidationApi
bin/magento module:disable Vertex_Tax
bin/magento module:disable Temando_ShippingRemover
bin/magento module:disable Dotdigitalgroup_Chat
bin/magento module:disable Dotdigitalgroup_Email
@ppcdias
ppcdias / magento2-truncate.sql
Last active February 3, 2023 07:30
Magento 2 Delete All Orders, Products, Categories, Customers, Reviews and Logs
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`;
@ppcdias
ppcdias / magento2.sh
Last active February 3, 2023 07:39
Magento 2 Useful CLI/SSH Commands List
# setup update and deploy if developer mode is enabled
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush
# set production mode and deploy
php bin/magento deploy:mode:set production
php bin/magento cache:clean
php bin/magento setup:upgrade
php bin/magento setup:di:compile