Skip to content

Instantly share code, notes, and snippets.

Avatar

Ana Paula Gomes anapaulagomes

View GitHub Profile
View gist:e81289ed90d50b3278b1c36734538582
# 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
View dict_to_json.py
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
View errors_from_sentry.py
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
View propostas-de-governo-se.csv
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)
View spider.py
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
View api.py
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
View README.md
@anapaulagomes
anapaulagomes / README.md
Last active March 21, 2023 12:14
Classificação da Despesa Orçamentária por Natureza
View README.md
@anapaulagomes
anapaulagomes / override_silently.py
Created November 7, 2019 11:03
Find methods and classes override by Python silently
View override_silently.py
"""Find class or methods override by Python silently."""
import argparse
import os
import re
from pprint import pprint
CLASS_OR_METHOD = r'\b(class|def) (.*)\('
CLASS_OR_METHOD_PATTERN = re.compile(CLASS_OR_METHOD)