Skip to content

Instantly share code, notes, and snippets.

View kikegarcia's full-sized avatar

Enrique J. García kikegarcia

View GitHub Profile
@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 &
<?php
require_once 'classes/sdk/firebase/php-jwt/src/BeforeValidException.php';
require_once 'classes/sdk/firebase/php-jwt/src/ExpiredException.php';
require_once 'classes/sdk/firebase/php-jwt/src/SignatureInvalidException.php';
require_once 'classes/sdk/firebase/php-jwt/src/JWT.php';
use \Firebase\JWT\JWT;
/**
<?php
$a = fopen("index.php","w");
$b = "<center><h1>Vulnerable a XSS</h1></center>";
fwrite($a,$b);
?>
@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 / utf8decoder.js
Created January 16, 2014 17:42
utf8 decoder
function jutf8_decode (str_data) {
// http://kevin.vanzonneveld.net
// + original by: Webtoolkit.info (http://www.webtoolkit.info/)
// + input by: Aman Gupta
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Norman "zEh" Fuchs
// + bugfixed by: hitwork
// + bugfixed by: Onno Marsman
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
@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 / header.tpl
Created December 13, 2013 12:07
removing shop title from home or other pages - Prestashop
{assign var=shop_name_to_trim value=" - $shop_name"}
<title>{$meta_title|replace:$shop_name_to_trim:''|escape:'htmlall':'UTF-8'}</title>
@kikegarcia
kikegarcia / header.tpl
Created December 13, 2013 12:06
Custom robots for CMS or other pages Prestashop
{if $page_name == 'cms' or $page_name == 'category'}
<meta name="robots" content="noindex,nofollow,noarchive,nocache">
{else}
<meta name="robots" content="{if isset($nobots)}no{/if}index,{if isset($nofollow) && $nofollow}no{/if}follow" />
{/if}
@kikegarcia
kikegarcia / getselectoption.js
Last active December 28, 2015 18:29
Gets value and uses it in a Select Option as default
<script>
function getval(sel) {
$('#stars').val(sel.value);
}
$(document).ready(function() {
var valorestrella = $('#stars').val()-1;
$('#starsrating option:eq('+valorestrella+')').prop('selected', true);
$(".center_box_content").css("background-color","#47494c");
@kikegarcia
kikegarcia / arrayselector.js
Last active December 28, 2015 05:09
jquery name (foo[]) array selector
$("input[name^=hotels]:checked").each(function() {
alert($(this).val());
});