Navigation Menu

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 / Varien_Cache_Backend_Database.patch
Created May 13, 2011 21:02
Patch for Magento's database backend
Index: lib/Varien/Cache/Backend/Database.php
===================================================================
--- lib/Varien/Cache/Backend/Database.php (revision 63515)
+++ lib/Varien/Cache/Backend/Database.php (working copy)
@@ -224,6 +224,7 @@
if ($this->_options['store_data']) {
$adapter = $this->_getAdapter();
$result = $adapter->delete($this->_getDataTable(), array('id=?'=>$id));
+ $tagResult = $adapter->delete($this->_getTagsTable(), array('cache_id=?' => $id));
return $result;
@fbrnc
fbrnc / is_leader.sh
Last active March 13, 2017 19:14
"Good enough" leader election script for AWS AutoScalingGroups
#!/usr/bin/env bash
function echoerr { echo "$@" 1>&2; }
function error_exit { echoerr "$1"; exit 1; }
if [ -z "${REGION}" ] ; then error_exit "No REGION set"; fi
command -v jq >/dev/null 2>&1 || error_exit "'jq' not found"
command -v aws >/dev/null 2>&1 || error_exit "'aws' not found"
command -v tee >/dev/null 2>&1 || error_exit "'tee' not found"
command -v ec2metadata >/dev/null 2>&1 || error_exit "'ec2metadata' not found"
@fbrnc
fbrnc / setup.sh
Last active March 5, 2017 01:53
X2GO PHPStorm Demo
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get -y install software-properties-common
# X2Go
add-apt-repository -y ppa:x2go/stable && apt-get update
apt-get -y install x2goserver
# Download PHPStorm
@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 / growl
Created August 8, 2016 18:15
Growl notification
#!/bin/bash
echo -n $'\e]9;'
echo -n $1
echo $'\007'
@fbrnc
fbrnc / file2cfn.php
Created October 31, 2015 05:07
CloudFormation File Helper
<?php
echo '{"Fn::Base64": {"Fn::Join": ["\n", ' . json_encode(file($argv[1], FILE_IGNORE_NEW_LINES), JSON_PRETTY_PRINT) . ']}}';
ssh-dss AAAAB3NzaC1kc3MAAACATEP3SRn8/N+bHiZBH8vjjaNpYRQoPSTICxPCWTCLH4dWQXUB0r/zZ/zi9DOcIDIVOJcZGE6Cb9rXMVccijVdQ1GBFf5hDburM3sLI/Eucogm2zApmCpn/IvwOUZymjpF821tIp+7qTGFopAOFDUZDUQzNWRqAqDgs1/WContRysAAAAVAJg6+p6vsCKCx41+KQBx4rx/gyTrAAAAgDOfKzbUJo/h+n0w2R1vKJNqZevLG41QlRH8ZFgb6yOn0VElj1QKu3oI/rId+t1ZDAjBwTY4XwtZfLsg+oDbhcbjoeuVJEXp8I6LOT1uypxfmjoiVFfum24qxnxJLxmCSM/wcXJani9FlMMop8BWm2hBRYrdZr2KW+qwpfNJbhGkAAAAgEeJI71mIfd4HKvWcaXrM4kOeuM2dZnosDC7VbLpYRDlMpTZzoi0l1DUlckJzSMXddEgJAcNIxEXIxOmxB4lwHlbqTsg4e8dX7D9u1jOZE8Zd64oGe1g/VxMLbo6JP6Wa8cowyigaA4VLb6QFnPYWeCFmPhvuBYdbLZ6uHAdud5T AOE Fabrizio Branca
@fbrnc
fbrnc / config.fish
Last active July 2, 2016 23:03
Fish config (~/.config/fish/config.fish)
# Path to your oh-my-fish.
set fish_path $HOME/.oh-my-fish
# Path to your custom folder (default path is ~/.oh-my-fish/custom)
#set fish_custom $HOME/dotfiles/oh-my-fish
# Load oh-my-fish configuration.
. $fish_path/oh-my-fish.fish
function fish_user_key_bindings
@fbrnc
fbrnc / gist:5673574
Last active June 14, 2016 17:01
Git Config
git config --global user.email "mail@address.com"
git config --global user.name "Fabrizio Branca"
git config --global color.ui auto
git config --global core.editor vi
git config --global alias.gm "merge --no-ff"
git config --global alias.st "status"
git config --global alias.s "status"
git config --global alias.p "push"
git config --global alias.d "diff"
git config --global alias.a "add"
@fbrnc
fbrnc / index.php
Last active January 15, 2016 17:24
AWS CloudFormation Events Visualization
<?php
/**
* AWS CloudFormation Events Visualization
*
* @author Fabrizio Branca
*/
/**
* Create an 'events.json' via using the AWS CLI Tool (or one of the SDKs...)
*