Skip to content

Instantly share code, notes, and snippets.

Gileno Filho gileno

Block or report user

Report or block gileno

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View video_utils.py
from urllib.parse import urlparse, parse_qs
def video_id(value):
"""Video ID from youtube, vimeo and facebook links
>>> video_id('http://youtu.be/SA2iWivDJiE')
'SA2iWivDJiE'
>>> video_id('http://www.youtube.com/watch?v=_oPAwA_Udwc&feature=feedu')
'_oPAwA_Udwc'
View dolar_urllib.py
import urllib.request
import re
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/5’
}
req = urllib.request.Request(url, headers=headers)
with urllib.request.urlopen(r) as response:
html = response.read().decode(‘utf-8’)
preco = re.findall(r'<input type="hidden" value="(.*)" id="taxa-comercial">', html)[0]
print(preco)
@gileno
gileno / utils.py
Created Oct 12, 2017
UTM to Latitude / Longitude
View utils.py
import math
def utm_to_latlng(easting, northing, zone=25, northernHemisphere=False):
if not northernHemisphere:
northing = 10000000 - northing
a = 6378137
e = 0.081819191
e1sq = 0.006739497
View verdade.py
import turtle
def letra_o(pen, x, y):
pen.up()
pen.goto(x, y)
pen.down()
pen.goto(x, y + 100)
pen.goto(x + 50, y + 100)
pen.goto(x + 50, y)
@gileno
gileno / contatos.py
Created Apr 4, 2017
Lista de Contatos
View contatos.py
numero = input("Quantos contatos quer cadastrar? ")
numero = int(numero)
contador = 0
emails = []
nomes = []
telefones = []
while contador < numero:
View simulador_dados.py
import random
def gerar_dado():
faces = input("Digite o número de faces: ")
faces = int(faces)
print("Simulador de Dados: ", random.randint(1, faces))
contador = 0
dados = input("Quantos dados vocês quer? ")
@gileno
gileno / adinha01.py
Last active Apr 4, 2017
Adivinha Araripina
View adinha01.py
import random
numero = random.randint(1, 100)
contador = 0
while contador < 5:
print("Tentativa de número: ", contador)
chute = input("Digite um chute: ")
@gileno
gileno / source.list
Created Apr 3, 2017
Linux Educacional source.list
View 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
View local_settings.py
# coding=utf-8
import os
DEBUG = True
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DATABASES = {
'default': {
@gileno
gileno / views.py
Created Feb 19, 2016
Django Filter
View views.py
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')
You can’t perform that action at this time.