Skip to content

Instantly share code, notes, and snippets.

View AlexR1712's full-sized avatar
🏠
Working from home

Alexander J. Rodriguez D. AlexR1712

🏠
Working from home
View GitHub Profile
/*************************************************
* This is a simple Monte Carlo simulation to see
* whether we should
* go for X BIG deal and/or Y SMALL deals.
*
* What is the best blend?
*
* Author: Ido Green | plus.google.com/+greenido
* Date: 16 July 2013
*
@AlexR1712
AlexR1712 / docker-install-parrot.sh
Created March 30, 2022 20:40 — forked from nuga99/docker-install-parrot.sh
Install Docker Engine on Parrot OS
#!/bin/sh
# From https://www.hiroom2.com/2017/09/24/parrotsec-3-8-docker-engine-en/
set -e
# Install dependencies.
sudo apt install -y curl apt-transport-https \
software-properties-common ca-certificates
# Install docker.
@AlexR1712
AlexR1712 / curl.sh
Created October 24, 2020 16:32 — forked from exAspArk/curl.sh
Test CORS with cURL
curl -I -X OPTIONS \
-H "Origin: http://EXAMPLE.COM" \
-H 'Access-Control-Request-Method: GET' \
http://EXAMPLE.COM/SOMETHING 2>&1 | grep 'Access-Control-Allow-Origin'
@AlexR1712
AlexR1712 / rename_incremental_order_by_modified_asc_date.sh
Last active August 28, 2019 20:29
Rename files based on the modified date, add incremental number to the begining of the filename.
ls -1rt | cat -n | while read n f; do mv -n "$f" "$n""_""$f"; done
@AlexR1712
AlexR1712 / checkSession.php
Last active November 1, 2022 01:43 — forked from lukas-buergi/checkSession.php
Check whether sessions work in php
<?php
error_reporting( E_ALL );
ini_set( 'display_errors', 1);
if(!isset($_GET['action'])){
die('Param is missing. Look at the <a href="https://gist.github.com/2995743">source</a>.');
}
switch($_GET['action']) {
@AlexR1712
AlexR1712 / !WhatsApp On Web Monitor.md
Last active December 13, 2018 14:24 — forked from parthpower/!WhatsApp On Web Monitor.md
Simple JS to monitor offline and online time of a contact.

WhatsApp On Web Monitor

What It does

It gives notifications when someone goes online or offline or typing. Open chat of the contact you want to monitor and start script.

Simple Way

@AlexR1712
AlexR1712 / activity.js
Last active June 2, 2018 01:12
Time Activity
// Script for track user activity in page and out the page
var timeActiveOnSite = 0; // seconds
var timeInactive = 0; // seconds
var lastActivityDatetime;
window.setInterval(function(){
if(document['visibilityState'] === 'visible'){
timeActiveOnSite++;
lastActivityDatetime = Date.now();
} else {
timeInactive++;
@AlexR1712
AlexR1712 / levenshtein.php
Created March 19, 2018 21:26
levenshtein. without native function
<?php
// Distancia Levenshtein en PHP (Sin usar la funciona nativa)
function lev($s,$t) {
$m = strlen($s);
$n = strlen($t);
for($i=0;$i<=$m;$i++) $d[$i][0] = $i;
for($j=0;$j<=$n;$j++) $d[0][$j] = $j;
@AlexR1712
AlexR1712 / README.md
Created February 12, 2018 20:44
Sequelize + Express + Migrations + Seed Starter
@AlexR1712
AlexR1712 / getElemClicked.js
Last active January 18, 2018 14:34
Get element clicked
document.addEventListener('click', function(e) {
e = e || window.event;
var target = e.target || e.srcElement,
text = target.textContent || text.innerText;
}, false);
// Version Two
if (document.addEventListener){
document.addEventListener("click", function(event){
var targetElement = event.target || event.srcElement;