Skip to content

Instantly share code, notes, and snippets.

Zdravko Karanovic zdravkok

Block or report user

Report or block zdravkok

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zdravkok
zdravkok / definer_remove
Created May 26, 2014
Remove Definer from sql before RDS import
View definer_remove
sed -e 's/DEFINER=[^*]*\*/\*/' rds.sql > rds1.sql
@zdravkok
zdravkok / del-attr-values
Created May 19, 2014
Delete unused attribute values from Magento
View del-attr-values
DELETE o, v
FROM eav_attribute a
INNER JOIN eav_attribute_option o ON a.attribute_id = o.attribute_id
INNER JOIN eav_attribute_option_value v ON v.option_id = o.option_id
INNER JOIN eav_entity_type t ON t.entity_type_id = a.entity_type_id
LEFT JOIN catalog_product_entity_int pi ON o.option_id = pi.value AND o.attribute_id = pi.attribute_id
LEFT JOIN catalog_product_entity_varchar pv ON o.option_id = pv.value AND o.attribute_id = pv.attribute_id
WHERE pi.entity_id IS NULL
AND pv.entity_id IS NULL
AND t.entity_type_code = "catalog_product"
@zdravkok
zdravkok / optimize-jpeg
Created May 19, 2014
Optimize jpeg images
View optimize-jpeg
find media/ -name "*.jpg" -type f -exec echo jpegtran -copy none -optimize -outfile {} {} \;
@zdravkok
zdravkok / reset permissions
Created May 14, 2014
Magento reset permissions
View reset permissions
sudo find . -type f -exec chmod 644 {} \;
sudo find . -type d -exec chmod 755 {} \;
sudo chmod o+w var var/.htaccess app/etc
sudo chmod 550 mage
sudo chmod -R o+w media
@zdravkok
zdravkok / robots_rewrite
Created Jan 27, 2014
swap between two robots.txt files depending on HTTP Protocol port
View robots_rewrite
RewriteEngine on
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^robots\.txt$ robots_ssl.txt [L]
@zdravkok
zdravkok / allow_require_if
Last active Jan 3, 2016
Future proof your Apache confs
View allow_require_if
<Directory>
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
You can’t perform that action at this time.