Skip to content

Instantly share code, notes, and snippets.

View gileno's full-sized avatar

Gileno Filho gileno

View GitHub Profile
@gileno
gileno / olx.py
Created June 22, 2015 22:42
Scrapy blog post III
# -*- coding: utf-8 -*-
import scrapy
class OlxSpider(scrapy.Spider):
name = "olx"
allowed_domains = ["pe.olx.com.br"]
start_urls = (
'http://pe.olx.com.br/imoveis/aluguel',
)
@gileno
gileno / olx.py
Last active August 29, 2015 14:23
Scrapy blog post IV
# -*- coding: utf-8 -*-
import scrapy
class OlxSpider(scrapy.Spider):
name = "olx"
allowed_domains = ["pe.olx.com.br"]
start_urls = (
'http://pe.olx.com.br/imoveis/aluguel',
)
@gileno
gileno / olx.py
Last active August 29, 2015 14:23
Scrapy blog post V
# -*- coding: utf-8 -*-
import scrapy
class OlxSpider(scrapy.Spider):
name = "olx"
allowed_domains = ["pe.olx.com.br"]
start_urls = (
'http://pe.olx.com.br/imoveis/aluguel',
)
@gileno
gileno / olx.py
Created June 29, 2015 00:48
Blog post VI
# -*- coding: utf-8 -*-
import scrapy
class OlxSpider(scrapy.Spider):
name = "olx"
allowed_domains = ["pe.olx.com.br"]
start_urls = (
'http://pe.olx.com.br/imoveis/aluguel',
)
@gileno
gileno / pipelines.py
Last active September 18, 2015 22:18
Blog post VII
# -*- coding: utf-8 -*-
import rethinkdb as r
class RethinkdbPipeline(object):
conn = None
rethinkdb_settings = {}
@gileno
gileno / middleware.py
Last active August 29, 2015 14:25
Middlware
from django.conf import settings
from django.http import Http404
class MeuMiddleware(object):
def process_request(self, request):
if request.META["REMOTE_ADDR"] in settings.IPS_PERMITIDOS:
pass
else:
raise Http404
@gileno
gileno / views.py
Created February 19, 2016 19:58
Django Filter
def minha_view(request):
marca = request.GET.get("marca", "")
if marcar:
context["brands_list"] = Post.objects.filter(is_active=True, brands__exact='MARCA01').order_by('created_date')
else:
context["brands_list"] = Post.objects.filter(is_active=True).order_by('created_date')
# coding=utf-8
import os
DEBUG = True
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DATABASES = {
'default': {
@gileno
gileno / source.list
Created April 3, 2017 14:54
Linux Educacional source.list
#deb cdrom:[LE 5.0 _le5/escola_ - Release i386 (20130421)]/ precise main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://br.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://br.archive.ubuntu.com/ubuntu/ precise main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://br.archive.ubuntu.com/ubuntu/ precise-updates main restricted
@gileno
gileno / adinha01.py
Last active April 4, 2017 17:40
Adivinha Araripina
import random
numero = random.randint(1, 100)
contador = 0
while contador < 5:
print("Tentativa de número: ", contador)
chute = input("Digite um chute: ")