Skip to content

Instantly share code, notes, and snippets.

View rgiaviti's full-sized avatar
Focusing

Ricardo Giaviti rgiaviti

Focusing
View GitHub Profile
@rgiaviti
rgiaviti / ldap_timestamp2date.rb
Last active September 30, 2016 18:31
This simple function converts LDAP Timestamp to Ruby DateTime object
# The MIT License (MIT)
#
# Copyright (c) 2016 Ricardo Giaviti
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software
# and associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@rgiaviti
rgiaviti / InstallingPostgreqSQLGem.sh
Last active September 30, 2016 18:31
Fixing error when installing PostgreSQL gem in Ubuntu 15.10
# The MIT License (MIT)
#
# Copyright (c) 2016 Ricardo Giaviti
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software
# and associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@rgiaviti
rgiaviti / SimpleRestClient.java
Created September 13, 2016 18:48
Simple REST Client using Jersey
/**
* The MIT License (MIT)
* Copyright (c) 2016 Ricardo Giaviti
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
@rgiaviti
rgiaviti / JarSelfSigning.sh
Last active April 20, 2018 17:52
Self signing a JAR file
# Copyright 2017 Ricardo Giaviti
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
# to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions
# of the Software.
#
@rgiaviti
rgiaviti / UnidadeFederacao.java
Last active April 4, 2025 21:14
Enum Java com todas as Unidades da Federação do Brasil
/**
* Enum com todas as Unidades da Federação do Brasil. Contém o nome da Unidade, a sigla e a capital
* da Unidade da Federação. As unidades estão listadas por ordem alfabética no enum.
*
* @author Ricardo Giaviti
* @version 1.1.1
* @since 1.0.0
*/
public enum UnidadeFederacao {
@rgiaviti
rgiaviti / unidades-federativas.json
Last active June 18, 2020 20:10
JSON com informações abertas sobre as Unidades Federativas do Brasil. Disponível para uso público.
{
"meta-info":{
"status": "DEPRECATED",
"data-ultima-atualizacao":"2018-07-25",
"data-referencia":"2017-07-01",
"versao":"1.0.2",
"website":"https://medium.com/@rgiaviti/unidades-federativas-do-brasil-como-json-1a40c0ec2cff",
"fontes":[
"IBGE",
"Constituição do Brasil"
@rgiaviti
rgiaviti / municipios-brasileiros.json
Last active September 19, 2023 17:56
Lista de municípios brasileiros em formato JSON e aberto para uso público. Fonte: IBGE
{
"meta-info":{
"status": "DEPRECATED",
"data-ultima-atualizacao":"2018-08-29",
"data-referencia":"2017-07-01",
"versao":"1.0.3",
"website":"https://medium.com/@rgiaviti/munic%C3%ADpios-brasileiros-em-formato-json-32337dd00d49",
"fontes":[
"IBGE"
]
@rgiaviti
rgiaviti / InterceptorExemplo.java
Last active November 12, 2020 20:10
Exemplo Interceptor - Spring Boot
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@RequiredArgsConstructor
public class WebConfiguration implements WebMvcConfigurer {
private final MyInterceptor requestInterceptor;
@rgiaviti
rgiaviti / ParserBCIPCA.py
Last active November 15, 2020 21:50
BACEN parser IPCA
import requests
import json
import datetime
bacen_ipca_url = "https://api.bcb.gov.br/dados/serie/bcdata.sgs.189/dados?formato=json"
output_json = "/home/bla/Desktop/igpm.json"
metadata = {
"status": "ATIVO",
"data-ultima-atualizacao": datetime.datetime.now().strftime('%d/%m/%Y'),
"versao": "1.1.0",
@rgiaviti
rgiaviti / modal-mais-excerpt-formatter.py
Created March 14, 2021 23:13
Formatador de Extrato da Modal Mais
from classes import ExcerptInfo
from datetime import datetime
import csv
EXCERPT_RAW_MODAL = ""
FORMATTED_EXCERPT_CSV = ""
class ExcerptInfo:
def __init__(self, date):