Skip to content

Instantly share code, notes, and snippets.

@nikolazic
nikolazic / products_no_images_magento_2.sql
Last active July 18, 2018 16:34
Products with no Images Magento 2
SELECT a.row_id, a.sku, a.type_id
FROM `catalog_product_entity` AS a
LEFT JOIN `catalog_product_entity_media_gallery_value_to_entity` AS b
ON a.row_id = b.row_id
WHERE b.value_id IS NULL;
#!/bin/bash
####
# Split MySQL dump SQL file into one file per table
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump
####
if [ $# -lt 1 ] ; then
echo "USAGE $0 DUMP_FILE [TABLE]"
exit
@nikolazic
nikolazic / new_gist_file_0
Created February 21, 2017 19:26
Exclude certain data from MySQL DB Dump
# Find out tha start and end for each table data and definition
grep -n 'Table structure\|Dumping data for table' superatv_prod-FULL-20170221.sql
...
406:-- Table structure for table `avatax_log`
429:-- Dumping data for table `avatax_log`
1361:-- Table structure for table `avatax_queue`
...
sed '429,1361 d' dump.sql > cleandump.sql
@nikolazic
nikolazic / mysqlsplitdump.sh
Created February 9, 2017 15:18
Split MySQL dump SQL file into one file per table
#!/bin/bash
####
# Split MySQL dump SQL file into one file per table
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump
####
if [ $# -ne 1 ] ; then
echo "USAGE $0 DUMP_FILE"
fi
@nikolazic
nikolazic / delete_merged_branches
Last active July 25, 2016 22:41
Delete all remote/local branches merged into develop
Local
git branch --merged master | grep -v 'master$' | grep -v 'develop$' | xargs git branch -d
REMOTE!
git branch -r --merged origin/develop | grep -v master | grep -v develop | sed -e 's/\// :/' | xargs -n2 git push
@nikolazic
nikolazic / magento-nginx.conf
Created October 9, 2015 14:26 — forked from gwillem/magento-nginx.conf
Battle-tested Nginx configuration for Magento (source: www.hypernode.com)
# This is an annotated subset of the Nginx configuration from our Magento production platform @ www.hypernode.com
# See https://www.byte.nl/blog/magento-cacheleak-issue
user app;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
@nikolazic
nikolazic / diff_show_files_only.sh
Created July 10, 2015 02:16
Diff show files only
diff -qr dir1 dir2
@nikolazic
nikolazic / add-user.php
Created June 5, 2015 16:38
Add new Magento Admin User
<?php
/**
* Create New Admin User
*
* Uncomment the 3 define lines and fill out the information
*/
//define('USERNAME','admin');
//define('EMAIL','support@gorillagroup.com');
//define('PASSWORD','TyLf%Dax7wD5');
@nikolazic
nikolazic / get_all_grants.sh
Created March 17, 2015 20:52
Get all users' grants
sudo mysql --silent --skip-column-names --execute "select concat('\'',User,'\'@\'',Host,'\'') as User from mysql.user" | sort | \
while read u
do echo "-- $u"; sudo mysql --silent --skip-column-names --execute "show grants for $u" | sed 's/$/;/'
done
@nikolazic
nikolazic / well_formedness_check.sh
Created January 13, 2015 21:02
Well Formedness Check for XML
find "./app" -name '*.xml' -exec xmllint --noout {} +