Skip to content

Instantly share code, notes, and snippets.

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

Adrián mrroot5

🏠
Working from home
View GitHub Profile
@mrroot5
mrroot5 / AESCipher.py
Created June 5, 2018 12:48 — forked from swinton/AESCipher.py
Encrypt & Decrypt using PyCrypto AES 256 From http://stackoverflow.com/a/12525165/119849
#!/usr/bin/env python
import base64
from Crypto import Random
from Crypto.Cipher import AES
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]
function arrify(val) {
return val == null ? [] : Array.isArray(val) ? val : [val];
}
@mrroot5
mrroot5 / validate_spanish_id.js
Created March 2, 2019 18:04 — forked from afgomez/validate_spanish_id.js
Spanish DNI, CIF, NIE validator
/**
* ValidateSpanishID. Returns the type of document and checks its validity.
*
* Usage:
* ValidateSpanishID( str );
*
* > ValidateSpanishID( '12345678Z' );
* // { type: 'dni', valid: true }
*
* > ValidateSpanishID( 'B83375575' );
@mrroot5
mrroot5 / json_schema_validator.py
Last active April 1, 2020 15:10 — forked from saadullahaleem/jsonschemafield.py
Django json schema validator
import json
import os
from django.contrib.postgres.fields import JSONField
from django.core.exceptions import ValidationError
from django.utils.deconstruct import deconstructible
from jsonschema import validate, exceptions as jsonschema_exceptions
@deconstructible