Skip to content

Instantly share code, notes, and snippets.

from bs4 import BeautifulSoup
import urllib2
print "O arquivo de saida estara no mesmo diretorio da aplicacao e tera o nome eventos.xls \n"
mes = raw_input("Digite o mes em numeral: ")
ano = '2015'
f = open('eventos' + mes + '.xls', 'w')
for dia in range(1,32):
dia = str(dia)
link = "http://www.cecon.pe.gov.br/eventos/?data-tipo=dia&data_inicial=" + dia + "%2F" + mes + "%2F" + ano
from json import loads
from urllib.request import urlopen
from urllib.parse import quote_plus
weather_key = "" #GET YOUR KEY AT OPENWEATHERMAP.ORG
def clima_tempo(city):
url = "http://api.openweathermap.org/data/2.5/weather?q=" + quote_plus(city) + "&lang=pt&units=metric&APPID=" + weather_key
html = urlopen(url).read().decode('utf-8')
weather = loads(html)
@licensed
licensed / [STEPS] RFID RC522 + RASPBERRY PI
Last active September 13, 2017 06:24
[STEPS] RFID RC522 + RASPBERRY PI
+-----------+----------+---------------------------------+
| | PCD | Raspberry |
| +----------+-------------+---------+---------+
| | MFRC522 | B+ | | |
+-----------+----------+-------------+---------+---------+
| Signal | Pin | Pin | | |
+===========+==========+=============+=========+=========+
| 3.3v | 3.3v | 1 (3V3) | | |
+-----------+----------+-------------+---------+---------+
| RST/Reset | RST | 22 (GPIO25) | | |
@licensed
licensed / PostgreSQL 9.6 Fix @ Archlinux
Last active August 17, 2017 16:56
PostgreSQL 9.6 Fix @ Archlinux
pacman -R postgresql
rm -rf /var/lib/postgres/data/*
pacman -S postgresql
su - postgres -c "initdb --locale en_US.UTF-8 -D '/var/lib/postgres/data'"
systemctl start postgresql.service
@licensed
licensed / Resolve conflcts
Last active October 3, 2017 20:08
Resolve conflcts
*Step 1. Fetch and check out the branch for this merge request*
git fetch origin
git checkout -b feature/desarquivamento origin/feature/desarquivamento
*Step 2. Review the changes locally*
*Step 3. Merge the branch and fix any conflicts that come up*
git checkout develop
@licensed
licensed / gist:41e609e6b8f8cfe412d7a3dc30698066
Created October 31, 2017 20:11
Save chrome download list
#01: Open console Ctrl+Shift+J
#02: Past the code below
#03: Save the list
ditems = document.querySelector("downloads-manager").shadowRoot.querySelector("iron-list").querySelectorAll("downloads-item");
var div = document.createElement('div');
[].forEach.call(ditems, function (el) {
var br = document.createElement('br');
@licensed
licensed / django_update_view.py
Created July 13, 2018 18:06 — forked from flavianmissi/django_update_view.py
Django UpdateView sample
#views.py
from django.views.generic import UpdateView
class UpdateBook(UpdateView):
model = Book
form_class = BookForm
template_name = 'create_form.html'
success_url = '/books/'
@licensed
licensed / paises-gentilicos-google-maps.json
Created August 10, 2018 22:02 — forked from jonasruth/paises-gentilicos-google-maps.json
JSON com lista de Países em pt-BR e seus respectivos Gentílicos, Siglas e Nome Internacional - Possui todos os países do Google Maps
[ { "gentilico" : "afegãne",
"nome_pais" : "Afeganistão",
"nome_pais_int" : "Afghanistan",
"sigla" : "AF"
},
{ "gentilico" : "sul-africana",
"nome_pais" : "África do Sul",
"nome_pais_int" : "South Africa",
"sigla" : "ZA"
},
@licensed
licensed / megasena.py
Last active February 6, 2022 19:27
Loteria / Mega Sena
#Simple Python Script for generate all possible combinations without repetitions
from itertools import combinations
# I want all possible combinations without repetition who haves numbers from 1 to 60
NUMBERS = 60
# Each possible combination haves 6 numbers
QUANTITY = 6
# Lines quantity by each file
LINES = 6000000
# Simple counter to control file lines limit

Keybase proof

I hereby claim:

  • I am licensed on github.
  • I am licensed (https://keybase.io/licensed) on keybase.
  • I have a public key ASDOK6Dte2-VaylZyrKBZmtsPLJDnA_nKz-MfOsmT_okTgo

To claim this, I am signing this object: