Skip to content

Instantly share code, notes, and snippets.

View gsomoza's full-sized avatar

Gabriel Somoza gsomoza

View GitHub Profile

Keybase proof

I hereby claim:

  • I am gsomoza on github.
  • I am somoza (https://keybase.io/somoza) on keybase.
  • I have a public key ASAnEmCHdmlMrD7R2rSD3zl69IMUVAH0yQdUmpTBLdStWgo

To claim this, I am signing this object:

@gsomoza
gsomoza / pre-push.bash
Created July 23, 2015 09:36
Git pre-push hook for Ant
#!/bin/bash
# FILE: .git/hooks/pre-push
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
read -p "You're about to push $current_branch. Did you already build with Ant? [y|n] " -n 1 -r < /dev/tty
echo
if echo $REPLY | grep -E '^[Yy]$' > /dev/null
then
exit 0 # push will execute
@gsomoza
gsomoza / README.md
Last active May 14, 2020 10:09
Magento CLI Media Cleaner

Magento CLI Media Cleaner

CLI utilities to clean the Magento media folders.

Features:

  • Clean unused images from the product catalog.
  • Clean the product catalog image cache.
  • Ready to use: automatically reads settings from app/etc/local.xml
  • FAST: I used it to safely clean about 45,000 images in just a couple of minutes.
@gsomoza
gsomoza / GabrielSomoza_ImageCdn_Model_Varien_Image.php
Last active December 18, 2015 05:49
ImageMagick Support for OnePica_ImageCdn
<?php
/**
* Overrides for OnePica_ImageCdn
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0), a
* copy of which is available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
@gsomoza
gsomoza / gist:5270172
Last active December 15, 2015 13:49
Useful Git Aliases
[alias]
# Usage: git nff {merge-branch}
# Checks out {merge-branch}, pulls, and merges recursively with the branch where this command was executed.
# In other words: it merges the current branch into {merge-branch}.
nff = !bash -c 'cb="$(git rev-parse --abbrev-ref HEAD)" && git checkout "$1" && git pull && git merge --no-ff $cb' -
# Usage: git cbranch
# Returns the name of the current branch
cbranch = rev-parse --abbrev-ref HEAD
@gsomoza
gsomoza / .bashrc
Created January 17, 2013 16:50
SSH Agent in Windows (Git Bash / MinGW)
#!bash.exe
export SSH_AUTH_SOCK=/tmp/.ssh-socket
echo ;
echo Starting connection with ssh-agent...
ssh-add -l 2>&1 >/dev/null
if [ $? = 2 ]; then
rm -f /tmp/.ssh-script /tmp/.ssh-agent-pid /tmp/.ssh-socket
# Exit status 2 means couldn't connect to ssh-agent; start one now
echo Creating new ssh-agent...
ssh-agent -a $SSH_AUTH_SOCK > /tmp/.ssh-script
@gsomoza
gsomoza / gist:3910863
Created October 18, 2012 10:11
EC2 Bash Prompt
#!/bin/bash
#Set colour prompt using the name, platform or instance id and avzone
if [ ! -f "/opt/aws/AWS-INSTID" ]; then
curl -s --fail http://169.254.169.254/latest/meta-data/instance-id > /opt/aws/AWS-INSTID
fi
export INSTID=`cat /opt/aws/AWS-INSTID`
if [ ! -f "/opt/aws/AWS-AVZONE" ]; then
curl -s --fail http://169.254.169.254/latest/meta-data/placement/availability-zone > /opt/aws/AWS-AVZONE
@gsomoza
gsomoza / ssh-copy-id.sh
Created February 14, 2012 10:30
Shell implementation of ssh-copy-id
#!/bin/sh
usage () {
echo "Usage: $0 [-i [identity_file]] [user@]machine"
exit 1
}
# Parse options
while getopts ":i:" o
do case "$o" in
@gsomoza
gsomoza / Acme_Dynamic.xml
Created April 1, 2011 13:44
Generating Dynamic Javascript for a Magento Module
<!-- app/etc/modules/Acme_Dynamic.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Acme_Dynamic>
<codePool>local</codePool>
<active>true</active>
</Acme_Dynamic>
</modules>
</config>
program aeropuerto;
uses crt;
const
OPCIONES = ['A','D','P','F'];
type
RegEvento = record
nroVuelo:integer;