Skip to content

Instantly share code, notes, and snippets.

View bplmp's full-sized avatar

Bernardo Loureiro bplmp

View GitHub Profile
@bplmp
bplmp / test_descriptions_in_dimensions.py
Created August 4, 2020 13:59
Sample LookML test for descriptions in dimensions
def test_descriptions_in_dimensions():
"""All dimensions must have descriptions
"""
errors = []
for lkml_file in LKML_DIMENSIONS:
dimensions_with_errors = []
for dimension in lkml_file['dimensions']:
if 'description' not in dimension:
dimensions_with_errors.append(dimension['name'])
if dimensions_with_errors:
@bplmp
bplmp / test_views_in_views_folder.py
Created August 4, 2020 14:02
Sample LookML test for views in view folder
def test_views_in_views_folder():
"""All views must be in `views` folder
"""
errors = []
for lkml_file in LKML_VIEWS:
if 'views' not in lkml_file['path_parent']:
errors.append(lkml_file['path'])
if errors:
assert False, errors
@bplmp
bplmp / test_avg_prefix_in_measures.py
Created August 10, 2020 18:55
Sample LookML test for avg measures
def test_avg_prefix_in_measures():
"""All average measures must be prefixed with avg_
"""
errors = []
for lkml_file in LKML_MEASURES:
for measure in lkml_file['measures']:
if measure['type'] == 'average' and measure['name'][:4] != 'avg_':
errors.append(lkml_file['path'])
if errors:
assert False, errors
@bplmp
bplmp / script.sh
Last active July 12, 2021 17:35
Extrair autos de infração do IBAMA de HTML para CSV
# baixe os dados
curl http://dadosabertos.ibama.gov.br/dados/SIFISC/auto_infracao/auto_infracao/auto_infracao.html > autos.html
# gere csv
# (primeiro passo é quebrar as linhas, acelera o processamento)
cat autos.html \
| sed -e 's|<\/tr>|\n|g' \
| sed -e 's/.*<thead\sbgcolor\=\"\#808080\">//' \
-e 's|\salign\=\"center\"||g' \
-e 's|<\/th>|\|\|\||g' \

Keybase proof

I hereby claim:

  • I am bplmp on github.
  • I am bplmp (https://keybase.io/bplmp) on keybase.
  • I have a public key whose fingerprint is 2CB2 3C54 3AD2 ACED FAE4 53E5 041D 5EF8 ACB1 2946

To claim this, I am signing this object: