Skip to content

Instantly share code, notes, and snippets.

Avatar

Agustin Ferrari aaferrari

View GitHub Profile
@aaferrari
aaferrari / cnp_generator.py
Created Apr 7, 2020
Generador de códigos validos para http://testingchallenges.thetestingmap.org/challenge4.php Al ejecutarlo genera 5 códigos
View cnp_generator.py
# -*- coding: utf-8 -*-
from random import choice
from datetime import datetime
# Se asume que los extranjeros nacieron en el sigo XX
centuries = {"1": "19", "2": "19", "3": "18", "4": "18", "5": "20", "6": "20", "7": "20", "8": "20", "9": "20"}
def gencnp():
cnp = []
cnp.append(str(choice(range(1,10)))) # Primer dígito
cnp.append('{:02d}'.format(choice(range(0,100)))) # Segundo y tercer dígito (año)
@aaferrari
aaferrari / casos de usuarios.md
Created Apr 7, 2020
Altas y autenticación de usuarios. Solo el usuario admin puede dar de alta nuevas cuentas.
View casos de usuarios.md
Time User Action
20/04/06(Mon)09:26 Prabooks Logged in
20/04/06(Mon)08:37 admin Added Moderator Prigone
20/04/06(Mon)07:23 admin Added Guest Agookint
20/04/06(Mon)06:37 Exclobs Logged out
20/04/06(Mon)06:15 admin Added Moderator Deaverm
20/04/06(Mon)05:09 Exclobs Logged in
20/04/06(Mon)05:00 admin Failed login attempt
20/04/06(Mon)01:13 admin Added Supermoderator Exclobs
@aaferrari
aaferrari / usercheck.php
Last active Apr 7, 2020
Demostración de un sistema simple para dar de alta y comprobar usuarios.
View usercheck.php
<?php
/*
* Para que funcione es necesario colocar este archivo en /var/www/localhost/htdocs/
* dentro de una carpeta con permisos de escritura. Utiliza SQLite como base de datos.
*/
header('Content-type: application/json');
$user = (empty($_POST['user']) === false ? $_POST['user'] : "");
$pass = (empty($_POST['pass']) === false ? $_POST['pass'] : "");
$output = Array();
View bloglenovo statistics.tsv
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 3 columns, instead of 1. in line 8.
Enlace Titulo Comentarios
bloglenovo.es/de-50-gramos-8-kilos-mini-altavoces-y-super-loros-para-el-movil/ De 50 gramos a 8 kilos, mini altavoces y super loros para el móvil 1
bloglenovo.es/igrill-el-termometro-digital-que-controlas-desde-tu-smartphone/ iGrill, el termómetro digital que controlas desde tu smartphone 1
bloglenovo.es/asi-seran-los-cuadros-del-futuro/ Así serán los cuadros del futuro 2
bloglenovo.es/es-necesario-desenchufar-la-tablet-una-vez-cargada/ ¿Es necesario desenchufar la tablet una vez cargada? 0
bloglenovo.es/cual-es-la-mejor-manera-de-limpiar-la-pantalla-del-movil-y-tablet/ ¿Cuál es la mejor manera de limpiar la pantalla del móvil y tablet? 0
bloglenovo.es/entrevista-aymar-de-lencquesaing-en-el-blog-xataka/ Entrevista a Aymar de Lencquesaing en el blog Xataka 0
bloglenovo.es/lenovo-presenta-resultados-y-habla-de-sus-productos-articulo-en-tic-beat/ Lenovo presenta resultados y habla de sus productos. Artículo en TIC BEAT 0
bloglenovo.es/preparate-para-la-vuelta-la-oficina-estos-son-los-17
@aaferrari
aaferrari / bloglenovo comments stats.py
Last active Feb 11, 2020
Obtiene la cantidad de comentarios que hay en los posts de bloglenovo.es (funciona con Python 2 y 3)
View bloglenovo comments stats.py
import re, json
from requests import request
from sys import version_info
if version_info.major == 2:
from urllib import urlencode
elif version_info.major == 3:
from urllib.parse import urlencode
unichr=chr
@aaferrari
aaferrari / No code diagram.txt
Last active May 7, 2020
ASCII diagram compatible with ditaa (https://github.com/stathissideris/ditaa). Output is https://i.imgur.com/phq0Yf9.png after processing
View No code diagram.txt
La felicidad de las nocode tools.
+----------------+ +--------+
|👤 Usuario feliz| |{d} |
+------------+---+ |Fichero |
| |proyecto|
| /--+--------+
| |
v v
+------+
|{io} |
@aaferrari
aaferrari / emerald-scraper.py
Last active Nov 27, 2018
Script para extraer informacion del catalogo de Emerald Video
View emerald-scraper.py
from BeautifulSoup import BeautifulSoup as bs
import re, requests
from braceexpand import braceexpand
patron_interpretes = re.compile('<a class="textoNormal" href="peliculas\.php\?action=search&tipo=interprete&que=[^"]+">([^<]+)')
patron_extras = re.compile('<b>Otros extras</b>: (.+)(?:<br>)</span>')
saltos = re.compile("[\r\n]")
def obtener_sinopsis():
global sopa
@aaferrari
aaferrari / csic.books.json
Created Nov 26, 2018
File generated with csic-scraper.py
View csic.books.json
[
{
"author": [
"Josep-Maria Gili",
"Bego\u00f1a Vendrell",
"Mag\u00ed Marc\u00e9"
],
"category": [
"Popular Science"
],
@aaferrari
aaferrari / csic-scraper.py
Created Nov 26, 2018
Scraper to extract information from Spanish National Research Council page
View csic-scraper.py
import scrapy, json
from scrapy.crawler import CrawlerProcess
class BookSpider(scrapy.Spider):
name = "freebooks"
start_urls = ['http://libros.csic.es/freebooks.php']
def parse(self, response):
# Because the HTML is malformed the links of the books are extracted with regular expressions
urls = list(set(response.css("#principal").re("http://libros.csic.es/product_info.php\?products_id=[0-9]+")))
@aaferrari
aaferrari / timetable2ical.sql
Last active Nov 1, 2018
Convert TimeTable subjects schedules into an iCal file.
View timetable2ical.sql
/*
To test it you need to extract the database of the application and execute the
SQL statements in an external program or from Android with the following command
(it is assumed that the device is rooted):
sqlite3 /data/data/com.gabrielittner.timetable/databases/timetable.db < timetable2ical.sql
*/
CREATE temporary TABLE weekdays ('day' INTEGER, 'short_name' CHAR, 'long_name' VARCHAR);
insert into weekdays values('1', 'MO', 'Monday');
insert into weekdays values('2', 'TU', 'Tuesday');
You can’t perform that action at this time.