Skip to content

Instantly share code, notes, and snippets.

View gsalibi's full-sized avatar

Gustavo Salibi gsalibi

View GitHub Profile
@gsalibi
gsalibi / validate_ibge.py
Last active March 2, 2022 17:12
This validates the IBGE municipal code and returns the 7th digit
def last_digit_ibge(cod6: str):
a = int(cod6[0])
b = (int(cod6[1]) * 2) % 10 + (int(cod6[1]) * 2) // 10
c = int(cod6[2])
d = (int(cod6[3]) * 2) % 10 + (int(cod6[3]) * 2) // 10
e = int(cod6[4])
f = (int(cod6[5]) * 2) % 10 + (int(cod6[5]) * 2) // 10
digit = (10 - (a + b + c + d + e + f) % 10) % 10
return str(digit)
{
"meta": {
"theme": "spartan"
},
"basics": {
"name": "Gustavo Salibi",
"label": "Programmer",
"picture": "",
"email": "gustavo.salibi@gmail.com",
"phone": "+5516997048764",