Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Adrián mrroot5

🏠
Working from home
View GitHub Profile
@mrroot5
mrroot5 / json_schema_validator.py
Last active Apr 1, 2020 — forked from saadullahaleem/jsonschemafield.py
Django json schema validator
View json_schema_validator.py
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 Mar 2, 2019 — forked from afgomez/validate_spanish_id.js
Spanish DNI, CIF, NIE validator
View validate_spanish_id.js
/**
* ValidateSpanishID. Returns the type of document and checks its validity.
*
* Usage:
* ValidateSpanishID( str );
*
* > ValidateSpanishID( '12345678Z' );
* // { type: 'dni', valid: true }
*
* > ValidateSpanishID( 'B83375575' );
View arrify.js
function arrify(val) {
return val == null ? [] : Array.isArray(val) ? val : [val];
}
@mrroot5
mrroot5 / AESCipher.py
Created Jun 5, 2018 — forked from swinton/AESCipher.py
Encrypt & Decrypt using PyCrypto AES 256 From http://stackoverflow.com/a/12525165/119849
View AESCipher.py
#!/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])]
View getnifs.py
#!/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 — forked from zhreshold/check_platform.py
Check OS/Python/Cpu Info and Network connections
View check_platform.py
"""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 Jan 19, 2018 — forked from andrewslince/install casperjs (and phantomjs) on ubuntu
Tutorial casperjs instalación, configuración y tips
View tutorial-casperjs.md

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 Mar 6, 2017 — forked from Kovak/main.py
Nesting Grid Layouts in Kivy
View buttonsgrid.kv
# buttonsgrid.kv
<VideoGrid>
cols: 1
rows: 1
Button:
text: 'Video'
<ButtonsGrid>:
cols: 3
rows: 5
Button:
@mrroot5
mrroot5 / telegram-installer.sh
Created Oct 29, 2016 — forked from jalcaldea/telegram-installer.sh
Small script that simplifies Telegram installation in ubuntu.
View telegram-installer.sh
#!/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 Oct 3, 2016 — forked from jelcaf/Operaciones-Git
Comando útiles para git.
View git_utils.md

Push

Listado completo

Reset

Listado completo

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

Volver a un commit anterior, descartando los cambios

git reset --HARD $SHA1

You can’t perform that action at this time.