Skip to content

Instantly share code, notes, and snippets.

@migcosta
migcosta / compare_2_mysql_dbs
Last active December 5, 2017 13:46
compre the db structure of 2 mysql databases
#https://stackoverflow.com/a/26384329/4970584
#for a quick solution
mysqldump --skip-comments --skip-extended-insert -d --no-data -u root -p dbName1 | sed 's/ AUTO_INCREMENT=[0-9]*\b//'>file1.sql
mysqldump --skip-comments --skip-extended-insert -d --no-data -u root -p dbName2 | sed 's/ AUTO_INCREMENT=[0-9]*\b//'>file2.sql
diff file1.sql file2.sql
#for a more complex solution use https://github.com/dlevsha/compalex
@migcosta
migcosta / max_width_email_template.html
Created December 11, 2017 15:14 — forked from stoyanvi/max_width_email_template.html
HTML Email Template: max-width hack for MS Outlook
<!--[if (gte mso 9)|(IE)]>
<center>
<table>
<tr>
<td width="600">
<![endif]-->
<div style="max-width: 600px; margin: 0 auto;">
<p>This text will be centered and constrained to 600 pixels even on Outlook which does not support max-width CSS</p>
</div>
<!--[if mso]>
<!--[if (gte mso 9)|(IE)]>
<center style=" background-color:red">
<table>
<tr>
<td width="280">
<![endif]-->
<div style="max-width:180px; margin:0 auto; background-color:blue">
<p>this will create a 280px on outlook/IE and a 180px on the other</p>
</div>
<!--[if (gte mso 9)|(IE)]>
@migcosta
migcosta / gist:3ddc7f15038ff242647970f36b7724e8
Last active March 15, 2018 11:18
virtual hosts location on apache
#to find your virtual hosts location on apache On (CentOS,Fedora, RHEL)
#1 - Find the httpd location
find / -name "httpd"
#2 - Dump the hosts
httpd -S
#(-S stands for: "synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG" )
@migcosta
migcosta / .htaccess
Created March 19, 2018 10:02
redirect local folder to remote folder on a different server
<IfModule mod_rewrite.c>
#redirect local folder to remote folder on a different server
RedirectMatch "^/[local-folder-name]/(.*)" "https://[remote-domain]/[remote-folder-name]/$1"
</IfModule>
@migcosta
migcosta / php-versions-installed
Created March 20, 2018 15:11
find the php versions installed
#find php versions installer
locate bin/php
@migcosta
migcosta / follow symbolic links
Created June 16, 2018 19:38
turnkey linux - follow symbolic links
Source
https://virtualboxes.org/doc/installing-guest-additions-on-debian/
Login as root;
Update your APT database with apt-get update;
Install the latest security updates with apt-get upgrade;
Install required packages with apt-get install build-essential module-assistant;
Configure your system for building kernel modules by running m-a prepare;
Click on Install Guest Additions… from the Devices menu, then run mount /media/cdrom.
Run sh /media/cdrom/VBoxLinuxAdditions.run, and follow the instructions on screen.
@migcosta
migcosta / virtualbox-mount-shared-folders-on-www
Created July 25, 2018 09:01
virtualbox mount shared folders on www
1 - turn off the VM
2 - add the shared folder with the auto mount option: folder name repos (on the VM it will be sf_repos)
3 - turn on the machine
4 - find the shared folder location: mount | grep vbox
5 - find the user id and the group id for that you whant to use:
id -u username
id -g username
6 - create a container folder on www: /var/www/remote
7 - edit ftabs: nano /etc/fstab
8 - add:*
@migcosta
migcosta / gist:92f1dfe70bda5f3c6950a82d5b7008df
Created February 7, 2019 14:22
magento 2.3 migration images issues
<?php
/**
* I faced a strange issue while migrating a magento 2.3 from a server to another.
* some of the product images where in a uppercase folder on the server and on a lowercase on the db
* the fix was to create links...
*/
//get the folders list from [magento root]/apps/magento/htdocs/pub/media/catalog/product
$folders = ["A","B","C","d","e","f","G","h","i","J","k","l","M","n","o","P","r","s","T","u","V","w","y"];
foreach( $folders as $folder )