Skip to content

Instantly share code, notes, and snippets.

View matheusgontijo's full-sized avatar

Matheus Gontijo matheusgontijo

View GitHub Profile
@DavMorr
DavMorr / gist:53e3ad5c26d16f4f6be3220b078b19c9
Last active October 21, 2024 10:20
Include hidden files in tar archive
When you create a tar archive of a directory tree the hidden files are normally not included. Here’s how to include the hidden files.
Say you have a web directory called “/var/www/html/mysite/” that contains the following tree:
.htaccess
index.php
logo.jpg
style.css
admin_dir/.htaccess
admin_dir/includes.php
@rogeriopradoj
rogeriopradoj / composer.json
Created July 2, 2017 17:07
mail.php - phpmailer + mailhog - send mail via smtp
{
"require": {
"phpmailer/phpmailer": "^5.2"
}
}
@schmengler
schmengler / add-checkout-form-key.sh
Last active September 2, 2022 16:23
Magento SUPEE-9767 Checkout Form Key Theme Patch
find -L app/design/frontend -regex '.*\(shipping\|billing\|shipping_method\|payment\).phtml' -exec grep -L formkey {} \; \
| xargs sed -i 's/<\/form>/<?php echo $this->getBlockHtml("formkey") ?><\/form>/g'
find -L skin/frontend -name 'opcheckout.js' -exec grep -L form_key {} \; \
| xargs sed -i 's/if (elements\[i\].name=='\''payment\[method\]'\'') {/if (elements[i].name=='\''payment[method]'\'' || elements[i].name == '\''form_key'\'') {/g'
@oivoodoo
oivoodoo / example
Created December 1, 2016 13:56
erlang remote debug
ssh -L 4369:localhost:4369 -L 9001:localhost:9001 ip -N
erl -name [email protected] -setcookie your_cookie -run observer
@molotovbliss
molotovbliss / mysql-large-db-import
Created November 29, 2016 18:05
Importing Large DB faster MySQL Settings
Source: https://dba.stackexchange.com/questions/83125/mysql-any-way-to-import-a-huge-32-gb-sql-dump-faster
innodb_buffer_pool_size = 4G
innodb_log_buffer_size = 256M
innodb_log_file_size = 1G
innodb_write_io_threads = 16
innodb_flush_log_at_trx_commit = 0
Why these settings ?
innodb_buffer_pool_size will cache frequently read data
@Nav-Appaiya
Nav-Appaiya / gist:892d759c1749fb9241ce169afe213f68
Created September 6, 2016 08:55
Magento 2 get all attributes from the default products attribute set (id: 4)
<?php
/** @var $coll \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection */
$coll = $this->_objectManager->create(\Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection::class);
// add filter by entity type to get product attributes only
// '4' is the default type ID for 'catalog_product' entity - see 'eav_entity_type' table)
// or skip the next line to get all attributes for all types of entities
$coll->addFieldToFilter(\Magento\Eav\Model\Entity\Attribute\Set::KEY_ENTITY_TYPE_ID, 4);
$attrAll = $coll->load()->getItems();
@thagxt
thagxt / mage2-multiweb-subdir.md
Last active May 2, 2024 14:03
Set up Magento 2 multiple websites in sub directories

Set up Magento 2 multiple websites in sub directories

  1. Go to Admin > Stores > All Stores
  2. Click > Create Web Site
  3. In the Name field, enter store name.
    • e.g. Japan
  4. In the Code field, enter a unique string without spaces and > Save Web Site
    • e.g. super_jp
  5. Create Store
  6. Create Store View
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active January 9, 2025 12:22
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

alias Rebirth.Subscription
alias Ecto.Query
Subscription |> Query.where([s], not is_nil(s.user_id))
@antillean
antillean / letsencrypt-cli.ini
Last active July 9, 2025 21:51
Sample letsencrypt-cli.ini file
# Becomes /etc/letsencrypt/cli.ini.
# This is an example of the kind of things you can do in a configuration file.
# All flags used by the client can be configured here. Run Let's Encrypt with
# "--help" to learn more about the available options.
# Use a 4096 bit RSA key instead of 2048
rsa-key-size = 4096
# Uncomment and update to register with the specified e-mail address