Skip to content

Instantly share code, notes, and snippets.

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

Miguel Angel fitorec

🏠
Working from home
View GitHub Profile
@fitorec
fitorec / AES.php
Last active June 3, 2023 18:19
Implementación del Algoritmo AES-256-CBC usando las librerías de OpenSSL
<?php
namespace App\Encryption;
class AES {
public static function generate_iv()
{
return openssl_random_pseudo_bytes(
openssl_cipher_iv_length('aes-256-cbc')
);
@fitorec
fitorec / stop_service_on_port.sh
Last active September 3, 2022 22:45
Stopping service on specific port
#!/bin/bash
#
#
# PROBLEM:
# ---------------------
# If we run:
# pkill gunicorn
# We stop all gunicorn services, in this case to start gunicorn we only need to stop the parent
# process associated with the service that attends the port where gunicorn will be executed.
#
@fitorec
fitorec / README.md
Last active May 2, 2022 08:48
Validador del checksum del número de Seguro Social de México, usando el algoritmo Luhn

Número de seguro social NSS

El numero de seguro social de México se conforma de 11 dígitos en donde el ultimo es el dígito verificador(Checksum), el cual es generado por el algoritmo Luhn.

Formato.

Formato img

Nota: para mayores informes consultar la definición del algoritmo en wikipedia: :point_right: https://es.wikipedia.org/wiki/Algoritmo_de_Luhn

@fitorec
fitorec / RFC-checksum.js
Last active April 29, 2022 18:08
ALGORITMO para calcular el checksum del RFC
const checksumCharRFC = (rfcInput = 'COSC8001137NA') => {
if (rfcInput.lenght < 12) {
throw new Error(`RFC(${rfcInput}) con Longitud incorrecta`)
}
const diccionario = '0123456789ABCDEFGHIJKLMN&OPQRSTUVWXYZ #'
const chars = rfcInput.replaceAll(/[Ñ|ñ]/g , '#').toUpperCase()
const len = rfcInput.length
const resultado = {
charInput: chars.charAt(len - 1),
@fitorec
fitorec / RFC-mx-metadata.js
Created April 28, 2022 19:48
Extracción de meta-datos a partir del RFC Mexicano
const altisonantes = [
'BACA', 'BAKA', 'BUEI', 'BUEY', 'CACA', 'CACO', 'CAGA', 'CAGO', 'CAKA',
'CAKO', 'COGE', 'COGI', 'COJA', 'COJE', 'COJI', 'COJO', 'COLA', 'CULO',
'FALO', 'FETO', 'GETA', 'GUEI', 'GUEY', 'JETA', 'JOTO', 'KACA', 'KACO',
'KAGA', 'KAGO', 'KAKA', 'KAKO', 'KOGE', 'KOGI', 'KOJA', 'KOJE', 'KOJI',
'KOJO', 'KOLA', 'KULO', 'LILO', 'LOCA', 'LOCO', 'LOKA', 'LOKO', 'MAME',
'MAMO', 'MEAR', 'MEAS', 'MEON', 'MIAR', 'MION', 'MOCO', 'MOKO', 'MULA',
'MULO', 'NACA', 'NACO', 'PEDA', 'PEDO', 'PENE', 'PIPI', 'PITO', 'POPO',
'PUTA', 'PUTO', 'QULO', 'RATA', 'ROBA', 'ROBE', 'ROBO', 'RUIN', 'SENO',
'TETA', 'VACA', 'VAGA', 'VAGO', 'VAKA', 'VUEI', 'VUEY', 'WUEI', 'WUEY'
@fitorec
fitorec / 00-checksum-clabe-bancaria-estandarizada.md
Last active March 20, 2024 19:01
Suma de validación(checksum) de la CLABE Bancaria Estandarizada en MX

Interface en Javascript ES6

Este es un simple ejemplo de una implementación de una interface entendiendo esta como una plantilla de clase que obliga a estas a implementar determinados métodos.

#!/bin/bash
# Se encarga de actualizar un determinado repositorio
# .---.
# / \
# \.@-@./
# /`\_/`\
# // _ \\
# | \ )|_
# /`\_`> <_/ \
#___\__/'---'\__/_______________________________________________________
@fitorec
fitorec / DbDump.php
Created March 2, 2020 19:58
Agregar comando Artisan de Laravel para backups de la base de datos
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables;
use Dotenv\Dotenv;
/**
/**/
#include <Arduino.h>
#include <libb64/cencode.h>
#include <ESP8266WebServer.h>
#include "MyWebServer.h"
ESP8266WebServer server(80);