Skip to content

Instantly share code, notes, and snippets.

Avatar
🚬
Code, Eat, Sleep++;

Jared molotovbliss

🚬
Code, Eat, Sleep++;
View GitHub Profile
@molotovbliss
molotovbliss / mysql-large-db-import
Created Nov 29, 2016
Importing Large DB faster MySQL Settings
View mysql-large-db-import
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
@molotovbliss
molotovbliss / terminalrc
Created Dec 14, 2017
Dracula Theme for XFCE4 Terminal
View terminalrc
ColorBackground=#28282a2a3636
ColorForeground=#f8f8f8f8f2f2
ColorSelection=#363639394848
ColorBold=#f4f47676c3c3
ColorCursor=#5050fafa7b7b
TabActivityColor=#5050fafa7b7b
ColorPalette=#000000000000;#9a9a40404646;#90907979b3b3;#929298986363;#3d3d98985a5a;#9a9a53538282;#3a3a4d4d5b5b;#8bfc8bfc8ccc;#4d4d4d4d4d4d;#ffff55555555;#cacaa9a9fafa;#f1f1fafa8c8c;#5050fafa7b7b;#ffff7979c6c6;#8b8be9e9fdfd;#f8f8f8f8f2f2
ColorSelectionUseDefault=FALSE
ColorBoldUseDefault=FALSE
@molotovbliss
molotovbliss / README.md
Last active Sep 7, 2021
Speed up warden for faster importing of large sql dumps.
View README.md

Speed up warden for faster importing of large sql dumps.

  1. Add the innodb options to the warden/environments/magento2.base.yml docker-compose YML file.
  2. Restart warden environment warden env down && warden sync stop && warden env up -d && warden sync start
  3. Import the .sql file with warden db import.
  4. Remove options & restart warden enviornment once import completed.

Why these settings

  • innodb_buffer_pool_size : Will cache frequently read data
@molotovbliss
molotovbliss / Mb-M2-resources.md
Created Mar 19, 2018
Magento2 Resources List; Needing a place to keep a list of all the tools/references used during Magento development.
View Mb-M2-resources.md
@molotovbliss
molotovbliss / remove-table-prefixes.sql
Last active May 31, 2021
Remove table prefixes MySQL
View remove-table-prefixes.sql
# Set @database, @old_prefix and @new_prefix (if you want a different prefix instead of removing)
# Execute the Generated SQL Query this generates to rename all tables found with prefix.
SET SESSION group_concat_max_len = 999999999;
SET @database = "databasename";
SET @old_prefix = "mgn_";
SET @new_prefix = "";
SELECT GROUP_CONCAT("RENAME TABLE ", TABLE_NAME, " TO ", replace(TABLE_NAME, @old_prefix, @new_prefix),'; ' separator '')
FROM information_schema.TABLES WHERE TABLE_SCHEMA = @database AND TABLE_NAME LIKE CONCAT(@old_prefix, '%');
View gist:2562551

Magento Snippets

Set all categories to is_anchor 1

Find attribute_id

SELECT * FROM eav_attribute where attribute_code = 'is_anchor'

Update all of them with anchor_id from above (usually is ID 51)

UPDATE `catalog_category_entity_int` set value = 1 where attribute_id = 51
@molotovbliss
molotovbliss / logrotate
Last active Apr 26, 2021
Magento Log Rotate with logrotate
View logrotate
The magento-logrotate.conf file contents:
/path/to/magento/var/log/*log {
rotate 7
daily
compress
missingok
notifempty
copytruncate
create 660 www-data www-data
@molotovbliss
molotovbliss / JSONArrayFileUtil.php
Last active Apr 2, 2021
Simple PHP Class to save an array to disk and read it back into a PHP Array using JSON.
View JSONArrayFileUtil.php
<?php
/**
* Save an PHP Array to disk with a delimiter to support
* multiple array values. Associative Array supported.
*
* @author Jared Blalock (jared.blalock@gmail.com)
* @link http://molotovbliss.com
*/
Class Json_Array {
View apache-as-proxy.conf
<FilesMatch \.php$>
<If "%{HTTP_COOKIE} =~ /XDEBUG_SESSION/">
SetHandler "proxy:fcgi://10.0.2.2:9172"
</If>
<Else>
SetHandler "proxy:fcgi://10.0.2.2:9072"
</Else>
ProxyFCGISetEnvIf "true" PATH_INFO "%{reqenv:SCRIPT_NAME}"
ProxyFCGISetEnvIf "true" SCRIPT_FILENAME "/var/www/vhosts/magento/pub%{reqenv:SCRIPT_NAME}"
</If>