Skip to content

Instantly share code, notes, and snippets.

@tinchodev
tinchodev / magento_uruguay_regions.sql
Created October 26, 2020 20:01
Magento 1/2 Uruguay Regions
INSERT INTO directory_country_region VALUES (NULL,'UY','AR','Artigas');
INSERT INTO directory_country_region VALUES (NULL,'UY','CA','Canelones');
INSERT INTO directory_country_region VALUES (NULL,'UY','CL','Cerro Largo');
INSERT INTO directory_country_region VALUES (NULL,'UY','CO','Colonia');
INSERT INTO directory_country_region VALUES (NULL,'UY','DU','Durazno');
INSERT INTO directory_country_region VALUES (NULL,'UY','FS','Flores');
INSERT INTO directory_country_region VALUES (NULL,'UY','FD','Florida');
INSERT INTO directory_country_region VALUES (NULL,'UY','LA','Lavalleja');
INSERT INTO directory_country_region VALUES (NULL,'UY','MA','Maldonado');
INSERT INTO directory_country_region VALUES (NULL,'UY','MO','Montevideo');
@tinchodev
tinchodev / categories_tree.sql
Created June 25, 2018 20:51
Fix magento product's categories tree
CREATE TABLE catalog_category_entity_tmp LIKE catalog_category_entity;
INSERT INTO catalog_category_entity_tmp SELECT * FROM catalog_category_entity;
UPDATE catalog_category_entity cce
SET children_count =
(
SELECT count(cce2.entity_id) as children_county
FROM catalog_category_entity_tmp cce2
WHERE PATH LIKE CONCAT(cce.path,'%')
);
@tinchodev
tinchodev / magento_nginx_https
Last active May 30, 2018 16:33
Magento NGINX HTTPS
openssl req -x509 -sha256 -nodes -newkey rsa:2048 -days 365 -keyout domain.key -out domain.crt
upstream fastcgi_backend {
#server 127.0.0.1:9000;
server unix:/var/run/php/php7.0-fpm.sock;
}
server {
listen 80;
listen 443 ssl;
ssl_certificate /var/server/web/ssl/domain.crt;
@tinchodev
tinchodev / apache_varnish_centos.txt
Created May 11, 2018 16:19
Apache + Varnish at Centos 7
# http://www.servermom.org/install-varnish-3-to-run-with-apache-2-on-centos-server/
rpm -Uvh https://packagecloud.io/varnishcache/varnish30/packages/el/6/varnish-3.0.7-1.el6.x86_64.rpm
yum install varnish
sudo nano /etc/httpd/conf.d/000-default.conf
NameVirtualHost *:8082
<VirtualHost *:8082>
> sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
> bind-address = 0.0.0.0
> sudo systemctl restart mysql.service
> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';
> FLUSH PRIVILEGES
@tinchodev
tinchodev / nginx.conf
Created February 3, 2018 20:26
NGINX configuration file for Magento 1.x
server {
listen 80;
server_name domain.tld www.domain.tld;
root /var/server/web/site;
location / {
index index.php index.html;
try_files $uri $uri/ @handler;
expires 30d;
@tinchodev
tinchodev / import_export_mysql_pipe_view.txt
Created December 11, 2017 15:03
Import Export Mysql Pipe View
# Export
mysqldump -uxxx -pxxx data_base > data_base.sql
# Import
mysql -uxxx -pxxx data_base < data_base.sql
# Import Pipe View
pv data_base.sql | mysql -uxxx -pxxxx data_base
# Import Source
@tinchodev
tinchodev / get_mysql_table_sizes.sql
Created December 5, 2017 21:06
Mysql : Get table sizes
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC;
@tinchodev
tinchodev / pipe_viewer_mysql.sh
Created December 5, 2017 15:30
Pipe Viewer Mysql Import
pv sqlfile.sql | mysql -uxxx -pxxxx dbname
@tinchodev
tinchodev / grant_root_remote_access.txt
Created March 3, 2017 15:57
Grant Root Remote Access MySQL
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Edit /etc/mysql/my.cnf
Comment address binding bind-address = 127.0.0.1 to #bind-address = 127.0.0.1