Skip to content

Instantly share code, notes, and snippets.

import requests
from bs4 import BeautifulSoup
requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS = 'ALL:@SECLEVEL=1'
payload = {'pagina': '1', 'data': '07/01/2019'}
url = 'https://antigo.agu.gov.br/agenda-autoridades/'
r = requests.post(url, data=payload, verify=False)
index user_name view_count caption comment_count forward_count kwai_id like_count timestamp url termo
0 D&W #Gospel 💜🙏💜 1590290 #Damares #A_batalha_do_Arcanjo 17623 116416 dwgospel 283278 1639007361892 http://ak-eg-cdn.kwai.net/upic/2021/12/09/07/BMjAyMTEyMDkwNzQ2MTBfMTUwMDAwOTU4NDA3MDk5XzE1MDA2MDM3MDM1MzE3NF8yXzM=_b_B747796555f6034c2c6906c6af056f0ad.mp4?tag=1-1665436177-sr-0-1udswg86ug-7e3d736c366af8bc damares
1 D&W #Gospel 💜🙏💜 589784 #Damares #Um_Novo_Vencedor 11901 54064 dwgospel 124453 1636659853728 http://ak-eg-cdn.kwai.net/upic/2021/11/12/03/BMjAyMTExMTIwMzM4MTZfMTUwMDAwOTU4NDA3MDk5XzE1MDA2MDMxMzYzNDEzOF8yXzM=_b_B2fafcb4a990c615112d5a666ec306c94.mp4?tag=1-1665436177-sr-0-jydcn38emw-e2a065a46554293e damares
6 #Denilson🏆JTV🏆 106764 #kwaistatus #consolador #damares # 635 8753 D1968 28309 1649361552013 http://ak-eg-cdn.kwai.net/upic/2022/04/08/03/BMjAyMjA0MDgwMzUzMzRfMTUwMDAwMDQ3MDI1MTg5XzE1MDA2MDY5NDA4NjU0NF8yXzM=_b_B5b5f5720007e4409b3d1a9506fb42ecb.mp4?tag=1-1665436177-sr-0-sm6xeqieh7-236669cbd70524fc dam
#!/bin/bash
for file in *
do
if [ -d "$file" ]
then
cd "$file"
for f in *
do
mv "$f" "${file}_${f}"
@belisards
belisards / create_mosaic.py
Last active November 26, 2021 16:00
Python script to create a mosaic from several photos - Source: Python Brasil community
# Baseado na função criada pela comunidade da Python Brasil, com pequenas mudanças
# Créditos: https://rgth.co/pt-br/blog/criando-a-foto-oficial-da-python-brasil-2020/
from PIL import Image
from pathlib import Path
coluna = 12
linha = 7
quadrado = 200
@belisards
belisards / dict_uf_br.py
Created August 13, 2021 05:33
python dictionary - states of Brazil and acronyms
br_states = {"Acre": "AC", "Alagoas": "AL", "Amapá": "AP", "Amazonas": "AM", "Bahia": "BA", "Ceará": "CE",
"Distrito Federal": "DF", "Espírito Santo": "ES", "Goiás": "GO", "Maranhão": "MA",
"Mato Grosso": "MT","Mato Grosso do Sul": "MS","Minas Gerais":"MG", "Paraná": "PR",
"Paraíba": "PB", "Pará": "PA", "Pernambuco": "PE", "Piauí": "PI", "Rio Grande do Norte": "RN",
"Rio Grande do Sul": "RS", "Rio de Janeiro": "RJ", "Rondônia": "RO", "Roraima": "RR",
"São Paulo": "SP", "Santa Catarina": "SC", "Sergipe": "SE", "Tocantins": "TO"
}
# Confusion matrix order:
# Thus in binary classification, the order is:
# [true negatives, false negatives]
# [true positive, false negatives]
from sklearn.metrics import confusion_matrix
import pandas as pd
real = ["cat", "ant", "cat","ant","cat"]
prediction = ["ant", "ant", "cat","cat","ant"]
Serial #,County,Type,Class,Premises Name,DBA,Address,Address 2,City,State,Zip,Date Inactive,Latitude,Longitude,Accuracy Score,Accuracy Type,Number,Street,Unit Type,Unit Number,City,State,County,Zip,Country,Source
2210254,ALBA,TW,344,POUR DECISIONS INC,BEER BONES TAP ROOM,594 NEW LOUDON RD,,LATHAM,NY,12110,3/12/2019 15:49:39,42.751147,-73.760234,0.6,street_center,,New Loudon Rd,,,Latham,NY,Albany County,12110,US,TIGER/Line® dataset from the US Census Bureau
2212813,ALBA,WS,308,FIREBALL FARM & CIDERS LLC,TILTED SHED CIDERWORKS,7761 BELL RD,,WINDSOR,CA,95492,3/12/2019 14:05:19,38.539658,-122.810046,1,range_interpolation,7761,Bell Rd,,,Windsor,CA,Sonoma County,95492,US,TIGER/Line® dataset from the US Census Bureau
1307974,BRON,A,122,1 WESTFIELD MARKET & DELI CORP,,3202 AMPERE AVE,,BRONX,NY,10465,3/14/2019 11:14:09,40.84614,-73.82095,1,rooftop,3202,Ampere Ave,,,Bronx,NY,Bronx County,10465,US,City of New York
1307974,BRON,A,122,1 WESTFIELD MARKET & DELI CORP,,3202 AMPERE AVE,,BRONX,NY,10465,3/14/2019 09:18:32,40.84
@belisards
belisards / gist:dd582dbccd96ca206c50de62e111363c
Created August 26, 2020 04:08
Junta shapefiles em uma pasta recursivamente
#!/bin/bash
consolidado="./consolidado.shp"
for i in $(find . -name '*.shp'); do
if [ ! -f "$consolidated_file" ]; then
# usa o primeiro arquivo para criar o arquivo final
ogr2ogr -f "ESRI Shapefile" $consolidated_file $i
else
# anexa os demais arquivos no consolidado
ogr2ogr -f "ESRI Shapefile" -update -append $consolidated_file $i
fi
#!/usr/bin/env python
# coding: utf-8
# In[2]:
import pandas as pd
import nltk
import itertools
from nltk.corpus import stopwords
from gensim import corpora, models
from nltk.stem import PorterStemmer
# github.com/belisards/coronabr/
library(tidyverse)
df <- read.csv("dados/corona_brasil.csv") %>%
mutate(date = as.Date(date))
ivis <- df %>% select(-local,-deads,-index,-confirmado) %>%
filter(date < "2020-03-19") %>% arrange(date)