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 / 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
@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' );
function arrify(val) {
return val == null ? [] : Array.isArray(val) ? val : [val];
}
@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])]
#!/usr/bin/python
# Based on https://gist.github.com/provegard/1536682, which was
# Based on getifaddrs.py from pydlnadms [http://code.google.com/p/pydlnadms/].
# Only tested on Linux!
from socket import AF_INET, AF_INET6, inet_ntop
from ctypes import (
Structure, Union, POINTER,
pointer, get_errno, cast,
@mrroot5
mrroot5 / check_platform.py
Created May 25, 2018 16:45 — forked from zhreshold/check_platform.py
Check OS/Python/Cpu Info and Network connections
"""Diagnose script for checking OS/hardware/python/pip/mxnet/network.
The output of this script can be a very good hint to issue/problem.
"""
import platform, subprocess, sys, os
import socket, time
try:
from urllib.request import urlopen
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
@mrroot5
mrroot5 / tutorial-casperjs.md
Last active January 19, 2018 13:52 — forked from andrewslince/install casperjs (and phantomjs) on ubuntu
Tutorial casperjs instalación, configuración y tips

CasperJS

CasperJS permite escribir test en JavaScript que se ejecutan en el navegador, permite testeo de navegadores headless o no según la librería empleada.

Podemos instalar CasperJS con PhantomJS o SlimerJS.

PhantomJS (no empleado actualmente)

Usa webkit mediante QtWebkit (v5.5 en el momento de escribir este README).

@mrroot5
mrroot5 / buttonsgrid.kv
Last active March 6, 2017 13:40 — forked from Kovak/main.py
Nesting Grid Layouts in Kivy
# buttonsgrid.kv
<VideoGrid>
cols: 1
rows: 1
Button:
text: 'Video'
<ButtonsGrid>:
cols: 3
rows: 5
Button:
@mrroot5
mrroot5 / telegram-installer.sh
Created October 29, 2016 16:29 — forked from jalcaldea/telegram-installer.sh
Small script that simplifies Telegram installation in ubuntu.
#!/bin/bash
echo "============================================="
echo "== Telegram Script Installer v 0.1 =="
echo "== =="
echo "== by Jalcaldea =="
echo "============================================="
echo "Downloading necesary files..."
@mrroot5
mrroot5 / git_utils.md
Last active October 3, 2016 13:34 — forked from jelcaf/Operaciones-Git
Comando útiles para git.

Push

Listado completo

Reset

Listado completo

#############################################

Volver a un commit anterior, descartando los cambios

git reset --HARD $SHA1