Skip to content

Instantly share code, notes, and snippets.

Thomas William thomaswpp

Block or report user

Report or block thomaswpp

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 pipelines.py
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pyodbc
class BlacktagPipeline(object):
View scrapy.py
import scrapy
class Blacktag(scrapy.Spider):
name = 'events'
start_urls = [
'https://blacktag.com.br/'
]
custom_settings = {
'DOWNLOAD_DELAY': 1.5,
'FEED_EXPORT_ENCODING':'utf-8'
View mdc.c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/*int mdc(int n1, int n2){
int resto = n1 % n2;
while(resto!=0){
n1 = n2;
View mdc.c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int calc_mdc(int n1, int n2, int n3){
int div, mdc = 1;
for(div = 2; div <= n1; div ++){
if((n1 % div == 0) && (n2 % div == 0) && (n3 % div == 0))
mdc = div;
View mdc.c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int mdc(int n1, int n2){
int resto = n1 % n2;
while(resto!=0){
n1 = n2;
n2 = resto;
View submarino.py
import requests
url = 'http://www.submarino.com.br/'
r = requests.get(url)
cookie = r.cookies.get_dict()
#print(cookie)
url = 'http://www.submarino.com.br/busca/?conteudo=notebook'
View metapicz.py
import requests
payload = {'action':'metadata-get',
'format':'html',
'imageUrl':'http://freevideolectures.com/blog/wp-content/uploads/2015/03/Big-data-free-courses.jpg'}
r = requests.post('http://metapicz.com/view.php', data=payload)
print(r.text)
View create_folder_logging.py
import logging
import datetime
import os
#recupera a data atual e divide em ano e mês
data = datetime.date.today().strftime("%Y-%m")
ano, mes = data.split('-')
#suposta função onde tem um dicionário que converte data em número em mes escrito
#por exemplo: você passa o número 10 e a função retorna outubro
View operadores.py
def teste(*args, **kwargs):
for key in kwargs.keys():
print(key)
for i in args:
print(i)
teste(nome="Thomas", sobrenome="William")
teste('1', '2', 'teste2', 'teste 4')
View netcraft.py
import requests
from bs4 import BeautifulSoup
#Aqui vamos capturar o html da página:
url = "https://news.netcraft.com"
response = requests.get(url)
#print(response.text)
#Pronto agora que temos o html, precisamos retirar o texto que nós interessa
#vi que o começo de toda notícia utiliza uma div com uma class="entry-content"
You can’t perform that action at this time.