Skip to content

Instantly share code, notes, and snippets.

View kikegarcia's full-sized avatar

Enrique J. García kikegarcia

View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 27, 2024 16:01
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@developernotes
developernotes / changelog.sh
Created July 5, 2012 20:45
Display a simple changelog between the last two tags in a Git repository
#! /usr/bin/env sh
firstTag=$(git tag | sort -r | head -1)
secondTag=$(git tag | sort -r | head -2 | awk '{split($0, tags, "\n")} END {print tags[1]}')
echo "Changes between ${secondTag} and ${firstTag}\n"
git log --pretty=format:' * %s' ${secondTag}..${firstTag}
@kikegarcia
kikegarcia / searchtagsPS.php
Last active December 20, 2015 08:59
search tags prestashop
if( isset($_POST['tags']) )
{
$searchTerms = explode(',', $_POST['tags']);
$searchTermBits = array();
foreach ($searchTerms as $term) {
$term = trim($term);
if (!empty($term)) {
$searchTermBits[] = ''.$term.'';
@kikegarcia
kikegarcia / blocklanguages.tpl
Created October 2, 2013 13:56
Block languages Prestashop inline
{*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
@kikegarcia
kikegarcia / JQdatepickerrestrictedrange.js
Last active December 25, 2015 02:19
Datepicker restrict range
<script>
$(document).ready(function(){
$('#txtStartDate').datepicker({
dateFormat: 'dd/mm/yy',
onSelect: function(dateText, inst) {
var pieces = dateText.split('/');
$('#day').val(pieces[0]);
$('#month').val(pieces[1]);
@kikegarcia
kikegarcia / confirmbeforeleave.js
Last active January 3, 2016 05:29
Confirm if you want to leave without saving the info
$(document).ready(function() {
formmodified=0;
$('form *').change(function(){
formmodified=1;
});
window.onbeforeunload = confirmExit;
function confirmExit() {
if (formmodified == 1) {
return "No has guardado la información. ¿Estás seguro de que quieres salir?";
}
@kikegarcia
kikegarcia / gist:0a923fe4b90d88eb20af6a29d5d29f29
Created April 20, 2016 14:42
Kill process if given process name and duration is more than X minutes
#!/bin/bash
PROC_NAME="sync/cli/cron.php"
FECHA=$(date +%Y%m%d)
BASE_LOG="/CODE/logs/operaciones/unblock_sync_v2_${FECHA}.log"
# bucle con pids que coinciden con el nombre del proceso
for pid in $(ps -fe | grep $PROC_NAME | grep -v grep | awk '{print $2}'); do
# Recoge el tiempo que lleva corriendo y limpiamos de simbolo :
@kikegarcia
kikegarcia / boot_selenium.sh
Last active June 30, 2022 11:49 — forked from xiaol825/install.txt
How to install Chrome, ChromeDriver and Selenium on CentOS. Plus a sample scraping script.
#!/bin/bash
nohup xvfb-run --server-args="-screen 0 1920x1080x24" java -Dwebdriver.chrome.driver="/usr/local/bin/chromedriver" -Dwebdriver.chrome.whitelistedIps="" -jar /opt/selenium-server-standalone.jar -role hub &
sleep 10
nohup xvfb-run --server-args="-screen 0 1920x1080x24" java -Dwebdriver.chrome.driver="/usr/local/bin/chromedriver" -Dwebdriver.chrome.whitelistedIps="" -jar /opt/selenium-server-standalone.jar -role node -hub http://10.160.1.5:4444/grid/register &