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
@AlexR1712
AlexR1712 / ValidateRIF.js
Last active October 2, 2024 20:19
Script to Validate SENIAT RIF number in Venezuela
const NATIONALITY_ARRAY = {
'V': '1',
'E': '2',
'J': '3',
'P': '4',
'G': '5',
'C': '3'
};
const MULTIPLIERS = [4, 3, 2, 7, 6, 5, 4, 3, 2];
@AlexR1712
AlexR1712 / Dockerfile
Last active May 17, 2024 21:35
Run Laravel Octane on docker using OpenSwoole and support to use Vite for Development
# Frontend Image
FROM node:20 as frontend
RUN mkdir -p /app/public
COPY package.json package-lock.json vite.config.js /app/
# Copy your JavaScript source files
COPY resources/ /app/resources/
WORKDIR /app
# Install dependencies
RUN npm ci
# Run build
/*************************************************
* 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;