Skip to content

Instantly share code, notes, and snippets.

View fbrnc's full-sized avatar

Fabrizio Branca fbrnc

  • AOE
  • Wiesbaden, Germany
  • X @fbrnc
View GitHub Profile
@fbrnc
fbrnc / gist:1705041
Created January 30, 2012 15:44
Magento switch to one column
<!-- do this: -->
<catalog_category_default>
<update handle="page_one_column" />
</catalog_category_default>
<!-- Also possible, but won't apply other settings that might be attached to the 1column layout (so don't do that...): -->
@fbrnc
fbrnc / gist:3418992
Created August 21, 2012 20:13
Magento Cache Warming
curl --silent http://example.com/sitemap.xml | xpath -q -e "/urlset/url/loc/text()" > tmp.urls && siege -v -c 1 -r `cat tmp.urls | wc -l` -f tmp.urls
@fbrnc
fbrnc / gist:3975149
Created October 29, 2012 17:44
Disable admin notifications
<!-- in local.xml -->
<!-- Note that enterprise modules have dependencies to Mage_AdminNotification, so disabling it this way could break something -->
<config>
<modules>
<Mage_AdminNotification>
<active>false</active>
</Mage_AdminNotification>
</modules>
</config>
@fbrnc
fbrnc / config.inc.php
Created November 26, 2012 17:02
Phpmyadmin configuration
<?php
$cfg['MaxTableList'] = 1000;
$cfg['ThemeDefault'] = 'original';
@fbrnc
fbrnc / gist:4218909
Created December 5, 2012 19:52
Magento Cache Warming
for i in `cat tmp.urls`
  do echo $i
  URLHOSTNAME=`echo "$i" | sed -e 's@.*//\([^/]*\)/*.*@\1@'`
  URLPATH=`echo "$i" | sed -e 's@.*//[^/]*\(/*.*\)@\1@'`
  for varnish in 'varnish1hostname varnish2hostname'; do
curl -H "Accept-Encoding: gzip, deflate" -H "Host: ${URLHOSTNAME}" -s -X GET -I http://$varnish/$URLPATH | egrep 'HTTP/|Age:|X-Cache'
  done
done
@fbrnc
fbrnc / gist:4550079
Last active September 25, 2017 11:53 — forked from michalochman/gist:3175175
Make Behat/Mink create a screenshot when a test fails
<?php
class FeatureContext extends MinkContext {
/**
* Take screenshot when step fails.
* Works only with Selenium2Driver.
*
* @AfterStep
*/
@fbrnc
fbrnc / backup_virtualbox.bat
Last active October 27, 2023 10:50
Daily backup of my devbox virtualbox machine during lunch time
@ECHO OFF
SET BACKUPSTORAGEPATH=\\AOE-nas\fabrizio.branca\backup\Virtualbox\
SET VBOXMANAGE="C:\Program Files\Oracle\VirtualBox\VBoxManage.exe"
SET VMNAME=devbox
IF NOT EXIST %BACKUPSTORAGEPATH% GOTO NOBACKUPDIRFOUND
echo Starting backup of VM '%VMNAME%' to %BACKUPSTORAGEPATH%
@fbrnc
fbrnc / gist:4760571
Created February 12, 2013 06:11
Create sku to id lookup table (as csv)
mysql -hHOST -uUSER -pPASS DBNAME -e 'select sku, entity_id from catalog_product_entity' -B | sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" > skuToId.csv
@fbrnc
fbrnc / gist:5105358
Created March 7, 2013 03:22
Create MySQL database and grant access to user
CREATE USER 'play'@'localhost' IDENTIFIED BY 'play';
GRANT USAGE ON *.* TO 'play'@'localhost' IDENTIFIED BY 'play' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
CREATE DATABASE IF NOT EXISTS play DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON `play`.* TO 'play'@'localhost';
FLUSH PRIVILEGES;
@fbrnc
fbrnc / gist:5122610
Created March 9, 2013 05:01
.htaccess additions for Magento devboxes
SetEnv MAGE_IS_DEVELOPER_MODE "true"
php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag log_errors on
php_value error_log /var/www/magentoplayground/devbox/htdocs/var/log/php_errors.log
# Also don't forget to copy errors/local.xml.sample to errors/local.xml