Skip to content

Instantly share code, notes, and snippets.

View juanriaza's full-sized avatar
🎯
Focusing

Juan Riaza juanriaza

🎯
Focusing
View GitHub Profile
Step #1 - views https://github.com/enjoydjango/dwitter/compare/step-00-startproject...step-01-views
Step #2 - templates https://github.com/enjoydjango/dwitter/compare/step-01-views...step-02-templates
Step #3 - tags https://github.com/enjoydjango/dwitter/compare/step-02-templates...step-03-tags
Step #4 - filters https://github.com/enjoydjango/dwitter/compare/step-03-tags...step-04-filters
Step #5 - inheritance https://github.com/enjoydjango/dwitter/compare/step-04-filters...step-05-inheritance
Step #6 - models https://github.com/enjoydjango/dwitter/compare/step-05-inheritance...step-06-models
Step #7 - database https://github.com/enjoydjango/dwitter/compare/step-06-models...step-07-database
Step #8 - tweetpage https://github.com/enjoydjango/dwitter/compare/step-07-database...step-08-tweetpage
Step #9 - profile https://github.com/enjoydjango/dwitter/compare/step-08-tweetpage...step-09-profile
Step #10 - followers https://github.com/enjoydjango/dwitter/compare/step-09-profile...step-10-followers
import requests
from lxml.html import fromstring, iterlinks
# https://github.com/zacharyvoase/urlobject/
from urlobject import URLObject
url = 'http://juanriaza.com'
req = requests.get(url, verify=False)
html_tree = fromstring(req.content)
html_tree.make_links_absolute(url, resolve_base_href=True)
import requests
from lxml import etree
req = requests.get('http://pyvideo.org/category/50/pycon-us-2014/rss')
xml_tree = etree.fromstring(req.content)
urls = [v.get('url') for v in xml_tree.findall(".//enclosure")]
print ' && '.join(['youtube-dl %s -f best ' % u for u in urls])
import asyncio
import requests
@asyncio.coroutine
def main():
loop = asyncio.get_event_loop()
future1 = loop.run_in_executor(None, requests.get, 'http://www.google.com')
future2 = loop.run_in_executor(None, requests.get, 'http://www.google.co.uk')
response1 = yield from future1
response2 = yield from future2

Keybase proof

I hereby claim:

  • I am juanriaza on github.
  • I am juanriaza (https://keybase.io/juanriaza) on keybase.
  • I have a public key whose fingerprint is 828F C11C 27CA 7960 4256 9097 6642 B33E 75C9 8B89

To claim this, I am signing this object:

# -*- coding: utf-8 -*-
import os
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
url = 'http://goo.gl/mff2'
print url
req = requests.get(url)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
PROJECT(phantompy)
SET(CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
#SET(CMAKE_BUILD_TYPE "Release")
SET(CMAKE_BUILD_TYPE "Debug")
SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
SET(CMAKE_AUTOMOC ON)
import tablib
lines = csv_data.split('\n')[:-1]
clean = lambda data: map(lambda e: e.strip('"'), data.split(','))
headers = clean(lines[0])
data = [clean(contact) for contact in lines[1:]]
parsed_data = tablib.Dataset(*data, headers=headers)
print parsed_data.json
import base64
import hashlib
from django.contrib.auth.hashers import BasePasswordHasher, mask_hash
from django.utils.crypto import constant_time_compare
from django.utils.datastructures import SortedDict
from django.utils.translation import ugettext_lazy as _
class SymfonyPasswordHasher(BasePasswordHasher):
@juanriaza
juanriaza / gist:4665340
Created January 29, 2013 16:01
renfe app api
{10: {'config': {'descripcion': 'Madrid',
'iconomapa': 'pin_cercanias',
'incidencias': 'http://infocer.renfe.es/informacionCercanias/incidenciasXML.do?login=aplinf1&password=HTULE593&idnucleo=10',
'lat': '40.40615564778484',
'lon': '-3.688957970842623',
'tarifas': 'http://www.renfe.com/viajeros/cercanias/madrid/abonos_y_descuentos/index.html'},
'content': {'dateTimeUpdate': '20130101113000',
'estaciones': 'http://api.mo2o.com/apps/RenfeApp/contents/estaciones_10.xml.gz',
'lineas': 'http://api.mo2o.com/apps/RenfeApp/contents/lineas_10.xml.gz',
'mapaesquematico': 'http://api.mo2o.com/apps/RenfeApp/contents/mapaesquematico_10.xml.gz',