Skip to content

Instantly share code, notes, and snippets.

View juanriaza's full-sized avatar
🎯
Focusing

Juan Riaza juanriaza

🎯
Focusing
View GitHub Profile
from gevent import monkey;
monkey.patch_all()
from gevent import Greenlet
from gevent.pool import Pool
from gevent.pool import Group
from gevent.queue import Queue
import gevent
from BeautifulSoup import *
import urllib, urllib2
import urllib2
class RequestWithMethod(urllib2.Request):
def __init__(self, method, *args, **kwargs):
self._method = method
super(RequestWithMethod, self).__init__(*args, **kwargs)
def get_method(self):
if getattr(self, '_method', False):
@juanriaza
juanriaza / LICENSE.txt
Created May 30, 2011 08:32 — forked from vjeux/LICENSE.txt
140byt.es -- Array Shuffle
Copyright (c) 2011 Christopher Chedeau, http://blog.vjeux.com/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@juanriaza
juanriaza / gist:1251409
Created September 29, 2011 17:52
check mrw
# -*- coding: utf-8 -*-
from __future__ import print_function
import requests
from lxml.html import fromstring
map(lambda event: print("Status: %(status)s Fecha: %(date)s Hora: %(hour)s" % dict([(e.attrib['class'], e.text) for e in event if 'class' in e.attrib])), fromstring(requests.get('http://mrw.es/seguimiento_envios/MRW_historico_nacional.asp?enviament=026928458321').content).cssselect('.zebra')[0][1])
# -*- coding: utf-8 -*-
"""
requests.async
~~~~~~~~~~~~~~
This module contains an asynchronous replica of ``requests.api``, powered
by gevent. All API methods return a ``Request`` instance (as opposed to
``Response``). A list of requests can be sent with ``map()``.
from django.core.validators import email_re
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
class YaraAuthenticationBackend(ModelBackend):
def authenticate(self, identification, password=None):
try:
if email_re.search(identification):
from django.utils import translation
from django.conf import settings
from django.utils.cache import patch_vary_headers
class UserLocaleMiddleware(object):
def process_request(self, request):
lang_session = request.session.get(settings.LANGUAGE_COOKIE_NAME)
if not lang_session:
var Data = {
_ownKeys: [],
_similar: [],
_appKey: 'listenAnywhere',
set: function(key, value)
{
var existingValue = localStorage.getItem(this._appKey);
if (null === existingValue) {
existingValue = {};
import requests
from lxml.html import fromstring, iterlinks
print 'wget %s' % ' && wget '.join(['http://lsi.vc.ehu.es/pablogn/docencia/ficheros/ISO1112/%s' % l[2] for l in filter(lambda x: x[2].endswith('pdf'), iterlinks(fromstring(requests.get('http://lsi.vc.ehu.es/pablogn/docencia/ficheros/ISO1112/').content)))])
// Settings in here override those in "Default/Preferences.sublime-settings", and
// are overridden in turn by file type specific settings.
{
"theme": "Soda Dark.sublime-theme",
"font_face": "The Sans Mono-",
"font_size": 14,
"rulers":
[
80
],