Skip to content

Instantly share code, notes, and snippets.

View dublado's full-sized avatar
📭
Send me a Telegram

Thiago Machado dublado

📭
Send me a Telegram
View GitHub Profile
@dublado
dublado / wc-add-modify-states.php
Created June 7, 2018 00:41 — forked from woogists/wc-add-modify-states.php
[General Snippets] Add or modify states
/**
* Add or modify States
*/
add_filter( 'woocommerce_states', 'custom_woocommerce_states' );
function custom_woocommerce_states( $states ) {
$states['XX'] = array(
'XX1' => 'State 1',
'XX2' => 'State 2'
@dublado
dublado / remove-billing.php
Created June 7, 2018 00:38 — forked from jgalea/remove-billing.php
Remove billing details from WooCommerce checkout.
<?php
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
@dublado
dublado / Howto convert a PFX to a seperate .key & .crt file
Created May 15, 2018 02:49 — forked from TemporaryJam/Howto convert a PFX to a seperate .key & .crt file
How to convert a .pfx SSL certificate to .crt/key (pem) formats. Useful for NGINX
source: http://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/
`openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]`
What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file.
Now let’s extract the certificate:
`openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]`
@dublado
dublado / customers.sql
Last active April 26, 2018 14:16 — forked from leek/_Magento1_DeleteTestData.md
Magento - Delete All Test Data - clean
SET FOREIGN_KEY_CHECKS=0;
-- Customers
TRUNCATE `customer_address_entity`;
TRUNCATE `customer_address_entity_datetime`;
TRUNCATE `customer_address_entity_decimal`;
TRUNCATE `customer_address_entity_int`;
TRUNCATE `customer_address_entity_text`;
TRUNCATE `customer_address_entity_varchar`;
TRUNCATE `customer_entity`;
@dublado
dublado / categories.sql
Created April 6, 2018 20:47 — forked from ajardin/categories.sql
How to clean up a Magento database
DELETE cce , cceda , ccede , ccei , ccet , ccev FROM catalog_category_entity cce
LEFT JOIN
catalog_category_entity_datetime AS cceda ON cce.entity_id = cceda.entity_id
LEFT JOIN
catalog_category_entity_decimal AS ccede ON cce.entity_id = ccede.entity_id
LEFT JOIN
catalog_category_entity_int AS ccei ON cce.entity_id = ccei.entity_id
LEFT JOIN
catalog_category_entity_text AS ccet ON cce.entity_id = ccet.entity_id
LEFT JOIN
@dublado
dublado / clean-magento_ce-db-extended.sql
Created April 6, 2018 20:47 — forked from frozenminds/clean-magento_ce-db-extended.sql
Clean Magento database of junk and unnecessary data
--
-- Magento CE database clean-up extended
--
-- This is an extended clean-up which will clean search, import/export, reports, etc.
--
-- @author Constantin Bejenaru <[email protected]>
-- @copyright Copyright (c) Constantin Bejenaru (http://frozenminds.com/)
-- @license http://www.opensource.org/licenses/mit-license.html MIT License
--
@dublado
dublado / Magento sanitiser
Created April 6, 2018 20:46 — forked from jimains/Magento sanitiser
Generic sql clean up Magento
-- this script is to be used on a DB dump from production
-- then this db can be dumped again, and used to override
-- a sample magento DB to add pepejeans catalog data and
-- sample configuration for dev VM
-- truncated tables will be truncated in magento db
-- dropped tables in this script will leave default magentodb tables
-- this script clears indexes, so the final db should be taken after reindexing in magento
SET foreign_key_checks = 0;
@dublado
dublado / ffmpeg-watermark.md
Created April 5, 2018 20:52 — forked from bennylope/ffmpeg-watermark.md
FFmpeg add a watermark to video

How to Add a Watermark to Video

FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to download a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.

Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.

@dublado
dublado / Remove Submodule
Created March 22, 2018 19:52 — forked from kyleturner/Remove Submodule
How to remove a submodule from a Github project
To remove a submodule you need to:
Delete the relevant line from the .gitmodules file.
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Commit and delete the now untracked submodule files.
@dublado
dublado / fix-wordpress-permissions.sh
Created March 22, 2018 18:37 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory