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:165c961546447bf44ab3
Created July 1, 2014 17:11
Install PHP 5.4 on AWS Opsworks Ubuntu 12.04 (note that Ubuntu 14.04 will install PHP 5.5 by default)
# Add this to the "setup" activity:
apt_repository "custom-php5-oldstable" do
uri "http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu"
distribution node['lsb']['codename']
components ["main"]
keyserver "keyserver.ubuntu.com"
key "E5267A6C"
action :nothing
subscribes :add, "template[/etc/sudoers]", :immediately
@fbrnc
fbrnc / gist:147bc6eaf187a15f1f75
Created June 15, 2014 15:32
Setup Samba on devbox
sudo apt-get -y install samba
# Set a password for your user in Samba (use "vagrant" as password)
sudo smbpasswd -a vagrant
# Add this to /etc/samba/smb.conf
[www]
path = /var/www
available = yes
valid users = vagrant
@fbrnc
fbrnc / gist:a6e2ef9630969a094f58
Created June 12, 2014 02:27
Instell chef-solo and berkshelf (on Ubuntu)
sudo su
apt-get update && apt-get install -y curl build-essential git libxml2-dev libxslt-dev libssl-dev
curl -L https://www.opscode.com/chef/install.sh | bash
/opt/chef/embedded/bin/gem install berkshelf --no-ri --no-rdoc
ln -s /opt/chef/embedded/bin/berks /usr/local/bin/berks
@fbrnc
fbrnc / shared_memory.sh
Last active August 29, 2015 14:00
Move given directories to shared memory and create symlinks
#!/bin/bash
for i in "$@" ; do
if [ -h $i ] ; then
echo "$i is a symlink";
SYMLINKTARGET=$(readlink -f "$i")
unlink "$i" || { echo "Error unlinking $i"; exit 1; }
if [ -d $SYMLINKTARGET ] ; then
echo "Moving $SYMLINKTARGET to $i"
@fbrnc
fbrnc / gist:8527270
Created January 20, 2014 19:22
Install Guest Additions
# Select "Install Guest Additions" in the VirtualBox Gui
apt-get update
apt-get install build-essential linux-headers-$(uname -r)
mkdir /media/cdrom
mount /dev/cdrom1 /media/cdrom
cd /media/cdrom
./VirtualBoxAdditions.run
@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 / gist:7244237
Created October 31, 2013 04:05
Minimum script to troubleshoot Magento database connection problems
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
set_include_path('lib' . PATH_SEPARATOR . get_include_path());
spl_autoload_register('autoload');
function autoload($class)
@fbrnc
fbrnc / gist:7051932
Last active December 25, 2015 22:39
DISCLAIMER: This is experimental! Never run this on a production database and create database backups before running this script in every case. Magento EE 1.13 populates some MySQL change log tables using triggers. but some of them might not be needed and won't be processed if the corresponding indexer is not being used (e.g. flat tables or full…
<?php
$table = 'catalogsearch_fulltext_cl';
// $table = 'catalog_product_flat_cl';
// $table = 'catalog_category_flat_cl';
$db = new mysqli('host', 'user', 'password', 'dbname');
if ($db->connect_errno > 0) {
die('Unable to connect to database [' . $db->connect_error . ']');
}
@fbrnc
fbrnc / gist:5864315
Last active December 18, 2015 23:49
Install some dev-tools
TARGETFOLDER="/usr/local/bin"
sudo curl -sSo $TARGETFOLDER/modman https://raw.github.com/colinmollenhour/modman/master/modman && sudo chmod +x $TARGETFOLDER/modman
sudo curl -sSo $TARGETFOLDER/n98-magerun.phar https://raw.github.com/netz98/n98-magerun/master/n98-magerun.phar && sudo chmod +x $TARGETFOLDER/n98-magerun.phar
sudo curl -sSo $TARGETFOLDER/phpunit.phar https://phar.phpunit.de/phpunit.phar && sudo chmod +x $TARGETFOLDER/phpunit.phar
sudo curl -sSo $TARGETFOLDER/phploc.phar https://phar.phpunit.de/phploc.phar && sudo chmod +x $TARGETFOLDER/phploc.phar
sudo curl -sS https://getcomposer.org/installer | php -- --install-dir=$TARGETFOLDER
@fbrnc
fbrnc / gist:5784176
Last active December 18, 2015 12:39
Seeing "Warning: include(): Failed opening 'File.php' for inclusion" errors in your logs?Check your cache settings in local.xml. The correct value is "File", otherwise it will still work because of the fallback but look up a non-existing file and flood your logs)
<config>
<global>
<cache>
<backend>File</backend>
<!-- not "Files", "files", or "file" (Although this mentioned in app/etc/local.xml.additional. It will work because it will fallback to the file backend, but it will flood your error log... -->
</cache>
</global>
</config>