Skip to content

Instantly share code, notes, and snippets.

View anapaulagomes's full-sized avatar

Ana Paula Gomes anapaulagomes

View GitHub Profile
@anapaulagomes
anapaulagomes / gist:203606d2df1bac5cdf806c56d4f8d45f
Last active March 19, 2024 17:58
How to deal with module not found in Jupyter notebooks
Source: https://stackoverflow.com/a/72778999
python -m venv venv
source venv/bin/activate
ipython kernel install --user --name=venv
jupyter notebook
go to kernel-->change kernel-->choose the venv from the dropdown
# https://gitlab.mister-muffin.de/josch/img2pdf
ls *.jpg | sort -n | tr '\n' ' ' | xargs img2pdf -o ebook.pdf
@anapaulagomes
anapaulagomes / dict_to_json.py
Created May 18, 2021 09:42
From dataclass/dict to JSON file
from dataclasses import asdict
import json
json.dump(asdict(my_object), open("my_object.json", "w"))
@anapaulagomes
anapaulagomes / errors_from_sentry.py
Created December 30, 2020 13:50
Retrieve errors from Sentry API
import json
import requests
def retrieve_errors(issue_id):
issue_id = "" # FIXME
endpoint = f"https://sentry.io/api/0/issues/{issue_id}/events/?full=True"
token = "" # FIXME
headers = {"Authorization": f"Bearer {token}"}
@anapaulagomes
anapaulagomes / propostas-de-governo-se.csv
Created November 3, 2020 10:53
Propostas de candidatos a prefeito em Sergipe
codigo_cidade_tse municipio sigla_estado codigo_prefeito_tse nome_urna url
31011 Amparo de São Francisco SE 260000686461 ALZIRA DE SALETE https://divulgacandcontas.tse.jus.br/candidaturas/oficial/2020/SE/31011/426/candidatos/401877/5_1600439475109.pdf
31011 Amparo de São Francisco SE 260000663375 ATEVALDO https://divulgacandcontas.tse.jus.br/candidaturas/oficial/2020/SE/31011/426/candidatos/361378/5_1600363475075.pdf
31011 Amparo de São Francisco SE 260001234505 FRANKLIN FREIRE https://divulgacandcontas.tse.jus.br/candidaturas/oficial/2020/SE/31011/426/candidatos/780356/5_1601143241998.pdf
31038 Aquidabã SE 260000863851 ANDERSON ANDRADE https://divulgacandcontas.tse.jus.br/candidaturas/oficial/2020/SE/31038/426/candidatos/583189/Proposta.pdf
31038 Aquidabã SE 260000660580 DR MÁRIO LUCENA https://divulgacandcontas.tse.jus.br/candidaturas/oficial/2020/SE/31038/2030402020/260000660580/pje-d2d8f962-Proposta de governo.pdf
31038 Aquidabã SE 260001041576 DR PHILIPPE https://divulgacandcontas.tse.jus.br/candidaturas
@anapaulagomes
anapaulagomes / spider.py
Created October 11, 2020 15:18
Find valid redirects (Scrapy)
import scrapy
class ImprensaOficialSpider(scrapy.Spider):
start_urls = ["http://www.imprensaoficial.org/acesso.htm"]
# example http://pmameliarodriguesba.imprensaoficial.org/
name = "imprensa_oficial"
TERRITORY_ID = None
handle_httpstatus_list = [301]
@anapaulagomes
anapaulagomes / api.py
Last active September 7, 2020 10:27
Twilio Call Queue
from flask import Flask, request
from twilio.twiml.voice_response import Dial, VoiceResponse, Gather
from calls import CallQueue
call_queue = CallQueue("support")
app = Flask(__name__)
AGENTS = {
"+000000000001": "Ana",
@anapaulagomes
anapaulagomes / README.md
Last active June 24, 2020 13:41
Filtra dados do Auxílio Emergencial por Código do Município no IBGE
@anapaulagomes
anapaulagomes / README.md
Created June 5, 2020 19:50
Beneficiários do Auxílio Emergencial em Feira de Santana
@anapaulagomes
anapaulagomes / README.md
Last active March 21, 2023 12:14
Classificação da Despesa Orçamentária por Natureza