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:7645313
Last active January 10, 2019 12:54
Reset Magento EE changelogs
truncate catalog_product_flat_cl;
truncate catalog_category_product_index_cl;
truncate catalog_category_product_cat_cl;
truncate catalog_category_flat_cl;
truncate catalogsearch_fulltext_cl;
truncate cataloginventory_stock_status_cl;
truncate catalog_product_flat_cl;
truncate catalog_product_index_price_cl;
truncate enterprise_url_rewrite_category_cl;
truncate enterprise_url_rewrite_product_cl;
@fbrnc
fbrnc / keybase.md
Created December 21, 2018 09:24
keybase.md

Keybase proof

I hereby claim:

  • I am fbrnc on github.
  • I am fbrnc (https://keybase.io/fbrnc) on keybase.
  • I have a public key ASB3WTuY4rB_v4d3YnnCk5vrK16eY-f6I0GfoWBkWywtQAo

To claim this, I am signing this object:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDylDQT7AW84cExfb2ILuzDu9Qv+Vb/W4/0CsUREnP5pEbsLbzt+4ccmPkitC1CXkhdb0Ok2GI6Vq3Y9M4pK3uYMdM4jPk+2l56nVwWkW83ysEhJmTgRaVSwoWFdRRTQeaFr5BVfOSboQb64Hs0gCm7twmDg+XUxrfci6xQFMYEglfTI86WjHosfHzEF2NLyBp5bHL6KqZ6by/Hfy5uIf2leDCWp3HwfgVzMZSgXn5VVPGU21do3fWemPKJLn4cmoBtbX6Mz1Fpx/nZsebuhb4biYH4EurrUj71LfXoy4w4VOPYUMWv0+ELss0Vc3Mz7ID5NcIU7LCQdbYd234d6Z5HbyR8A0FAKEwkEOmN0vEE8/ahCkDQuUzH/RnDJuHdnLvCN67Y/U2TipPDke/XVBW0J9Z5wBbU33QIM95A+toO/271EY7Dy2dkLp5rkmhPvrUs9Rph2IF+LE24N8Gc0Wn/BIBw94oCeaWjcdAJ5nuOQmL+MUU/H1FCU3uDeQ1kuJ9VyxKgHlpa2LppIOQ6mlMgVdGMUzn6uf4Hv3FyVvURx7cn+kbbuxTuAnrQWZhTcN+jjDNxCNLVNmh6SWz/J5eZm3kGTZdcehF0FNhBQP+SogmjSKurtRtPHyT3lvToXktqlnbsAAOh+dFp5Xt48QfIZ7knltipIKqBvnnxQ7BvDQ== Fabrizio 2016
@fbrnc
fbrnc / AjaxLoader.ino
Last active May 3, 2018 00:22
Hardware AJAX Loader using an Attiny85, 3 potentiometers and a 24 RGB LED ring
#include <FastLED.h>
#define NUM_LEDS 24
#define NUM_DOTS 3
#define DATA_PIN 0
#define MAX_SPEED 60
using namespace std;
CRGB leds[NUM_LEDS];
@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:a758315e2d9af024ab0f
Last active March 11, 2018 07:49
What's wrong with Catalogrule's cron job?

catalogrule/observer::dailyCatalogUpdate called by the catalogrule_apply_all cron job will delete block caches every night:

https://github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/core/Mage/CatalogRule/Model/Rule.php#L319

What's wrong with this?

  1. It shouldn't do this if there are no catalog rules in the first place.
  2. Even if there are catalog rules it should check if the current execution time is close to any job's start or stop date and only flush caches then.
  3. The configuration (https://github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/core/Mage/CatalogRule/etc/config.xml#L102-104) basically only allows adding caches, but not removing any caches.
  4. Cleaning caches - if actually required - should happen after reindexing. It's not safe to assume that noone will hit any affected page after it was cleaned and before the indexers are done.
@fbrnc
fbrnc / gist:8ed33626f2fdeb4507df
Created August 13, 2014 03:27
Install Chef and Berkshelf on Ubuntu
#!/bin/bash
apt-get -y update
apt-get -y install build-essential ruby-dev git curl build-essential libxml2-dev libxslt-dev libssl-dev autoconf
if [ ! -e /opt/chef/bin/chef-solo ] ; then
curl -L https://www.opscode.com/chef/install.sh | bash
fi
if [ ! -e /opt/chef/embedded/bin/berks ] ; then
/opt/chef/embedded/bin/gem install berkshelf --no-ri --no-rdoc
@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 / grafana_backup.sh
Created May 18, 2016 15:29
Grafana Backup
BASEURL=http://username:password@127.0.0.1:3000
for dash in $(curl -s -k "${BASEURL}/api/search" | jq -r '.[].title'); do
curl -k "${BASEURL}/api/dashboards/db/${dash}" > "${dash}.json"
done
@fbrnc
fbrnc / gist:1262502
Created October 4, 2011 19:12
Magento priority configuration for TwoLevels cache backend
Index: app/code/core/Mage/Core/Model/Cache.php
===================================================================
--- app/code/core/Mage/Core/Model/Cache.php (revision 124392)
+++ app/code/core/Mage/Core/Model/Cache.php (working copy)
@@ -44,7 +44,7 @@
/**
* Cache frontend API
*
- * @var Zend_Cache_Core
+ * @var Varien_Cache_Core