Skip to content

Instantly share code, notes, and snippets.

View gsomoza's full-sized avatar

Gabriel Somoza gsomoza

View GitHub Profile
@gsomoza
gsomoza / durations.js
Created February 15, 2024 14:27
Jenkins Job Total Durations
/*
* Run this on the Blue Ocean activity page to add up all job durations visible on that page.
*/
(function(){
const durations = [...document.querySelectorAll('[data-runid] a:nth-of-type(5) span')].map(i => i.textContent);
console.log(durations);
const validDurations = durations.filter(duration => !duration.startsWith("<"));
@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>
@gsomoza
gsomoza / ztvpn.sh
Last active September 28, 2020 04:17
ZeroTier VPN Switch Script
#!/bin/bash
ZT_NETWORK="NETWORK_ID"
# colors
RCol='\033[0m' # Text Reset
LGra='\033[0;37m';
Red='\033[0;31m';
Gre='\033[0;32m';
Yel='\033[0;33m';
@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.
find . -type f -name "*Test.php" -exec sed -i '' s/@cover/c_over/g {} +
find . -type f -name "*Test.php" -exec sed -i '' s/@use/u_se/g {} +
@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 / p2-test.js
Last active February 14, 2019 08:37 — forked from damian-pastorini/P2JS
My first P2 impact test code....
this.p2world.on('impact', function(evt){
var playerBody,
currentPlayer = this.state.players[client.sessionId];
console.log('Body positions: ', evt.bodyA.position, evt.bodyB.position);
if (evt.bodyA.hasOwnProperty('playerId')) {
playerBody = evt.bodyA;
} else if (evt.bodyB.hasOwnProperty('playerId')) {
playerBody = evt.bodyB;
@gsomoza
gsomoza / s3-presign-url.py
Last active August 6, 2018 12:45
S3: Create Presigned Download URL
#!/usr/bin/env python
# Usage:
# s3-presign-url path/to/object
#
# 1) Install boto3:
# pip install boto3
# 2) Configure aws:
# aws configure
# 3) Change the bucket name in this script (below)
@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 / PATCH_SUPEE-9767_EE_1.12.0.2_v2-2017-07-11-11-08-20.sh
Last active July 19, 2017 14:09
SUPEE-9767 fixed for EE 1.12.0.2 (the officially distributed version didn't work for us)
#!/bin/bash
# Patch apllying tool template
# v0.1.2
# (c) Copyright 2013. Magento Inc.
#
# DO NOT CHANGE ANY LINE IN THIS FILE.
# 1. Check required system tools
_check_installed_tools() {
local missed=""