Skip to content

Instantly share code, notes, and snippets.

@chris-huffman
chris-huffman / install_ioncube.sh
Created May 18, 2020 21:22
Install Ioncube Loader
cd /tmp
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xfz ioncube_loaders_lin_x86-64.tar.gz
#Note: this install is specific to a specific version of PHP. Make sure to use the correct one for your system. The example below is using PHP 7.2.
php -v
Ioncube install:
copy ioncube_loader_lin_7.2.so to /usr/lib64/php/modules/
@chris-huffman
chris-huffman / rename_files.sh
Created May 26, 2020 19:17
Bash script to rename images. (This example, append "_1".)
for i in *.png; do mv "$i" "${i/.png}"_1.png; done
@chris-huffman
chris-huffman / elasticsearch_commands.sh
Last active June 12, 2020 18:48
CLI Commands to Interact with ElasticSearch (v6)
#Show indexes
curl 127.0.0.1:9200/_cat/indices
#Update max_result_window to avoid error about "Result window is too large"
curl -XPUT "http://localhost:9200/magento2_product_1_v2/_settings" -d '{ "index" : { "max_result_window" : 500000 } }' -H "Content-Type: application/json"
@chris-huffman
chris-huffman / pull-subscription-data.sql
Created July 21, 2020 18:43
Pull ParadoxLabs Subscription Data
SELECT
s.increment_id,
c.firstname,
c.lastname,
qa.city,
qa.region,
qa.postcode
FROM
`paradoxlabs_subscription` AS s
JOIN `customer_entity` AS c ON s.customer_id = c.entity_id
@chris-huffman
chris-huffman / Force Production Mode
Created December 9, 2020 22:35
Force a local site to run in production mode
From within vagrant:
* $ sudo vi /etc/httpd/conf.d/httpd.conf
* SetEnv MAGE_IS_DEVELOPER_MODE 0
* SetEnv MAGE_MODE production
* $ MAGE_MODE=production
* $ bin/magento deploy:mode:set production
* $ sudo systemctl restart httpd
@chris-huffman
chris-huffman / query_largest_tables.sql
Created January 13, 2021 17:56
Gets the 10 largest tables in a db.
SELECT CONCAT(table_schema, '.', table_name),
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows,
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA,
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx,
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size,
ROUND(index_length / data_length, 2) idxfrac
FROM information_schema.TABLES
ORDER BY data_length + index_length DESC
LIMIT 10;