Skip to content

Instantly share code, notes, and snippets.

View becahp's full-sized avatar

Rebeca Moura becahp

  • Brasília, Brazil
View GitHub Profile
becahp /
Last active February 7, 2020 16:15
Reading a HDR file from ENVI/Abilio and storing into a python dictionary
#filename = 'abilio.hdr'
file = open(base_path/filename_hdr)
lista = file.readlines() #todo o arquivo esta em lista
dicionario = {}
for i in range(len(lista)):
parts = lista[i].split('=') #return list: ('times ',' 1\n')
termo = ''
comp = ''
becahp /
Created July 2, 2020 00:01
Little snippet to create a word count dictionary
def conta_palavras(text, stop_words, punctuations):
#divide o texto em tokens
tokens = word_tokenize(text)
#remove as stopwords e pontuacao
keywords = [word for word in tokens if not word in stop_words and not word in punctuations]
#gera dicionario com as palavras e contagem
wordcount = {}
for word in keywords:
word = word.lower() #todas minúsculas
becahp / busca-cep-lat-lon.ipynb
Created August 5, 2020 17:30
Busca CEP - Lat, Lon.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
becahp /
Last active August 31, 2020 22:47
clean a string
#!pip install Unidecode
import unidecode
def clean_string(str):
str = str.strip()
str = str.replace(" ","") #remover espaços
str = str.replace("'","") #remover apóstrofos
str = str.lower() #colocar tudo em minúsculas
str = unidecode.unidecode(str) #remover acentuação
return str
becahp / Listas Elementor.css
Created November 26, 2020 20:49
Listas dos Elementor
Sometimes Elementor doesn't print out the bullets/numbers of an ordered list
You need to add an ID to the section (listBullet or listNumber) and define the following css:
.listBullet li{
list-style-type: disc;
margin-left: 20px;
margin-top: 5px;