Skip to content

Instantly share code, notes, and snippets.

View weltonrodrigo's full-sized avatar
🏠
Working from home

Welton Rodrigo Torres Nascimento weltonrodrigo

🏠
Working from home
  • Brasília, Distrito Federal, Brasil
View GitHub Profile
@weltonrodrigo
weltonrodrigo / gerar-certificado-icp-brasil.md
Created January 24, 2023 02:50
Como gerar um certificado ICP-Brasil A3 (pessoa física) para testes

O formato do certificado ICP-Brasil está disponível nas políticas das autoridades certificadoras autorizadas pelo ICP-Brasil. Exemplo: https://repositorio.acdigital.com.br/docs/pc-a3-ac-digital-multipla.pdf

Ver item 7.1.2.3.a.

Para certificado CNPJ, o procedimento é parecido, só montar os campos de acordo com o item 7.1.2.3.b

openssl req -new -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 \
-subj '/C=BR/O=ICP-Brasil/OU=AC DIGITAL Múltipla G1/OU=33989214000191/OU=presencial/OU=Certificado PF A3/CN=Fulano de tal:58765136012' \
@weltonrodrigo
weltonrodrigo / pixify.py
Created December 1, 2023 21:40
Pixar character generator
#!/usr/bin/env python3
import base64
import requests
import argparse
import os
import json
""" Access to gpt-4-vision and dall-e 3 is necessary """
# OpenAI API Key
@weltonrodrigo
weltonrodrigo / vm-deallocate-itself.md
Created October 29, 2022 13:54
Configure a Azure VM to deallocate itself on shutdown

How to configure an Azure VM to self deallocate on shutdown?

At the Azure Portal:

  1. Activate system identity for the vm: VM -> identity -> System assigned -> Status ON -> Save
  2. Give the VM permission to manage itself -> VM -> IAM -> Add role assignment -> Virtual Machine Contributor -> Managed Identity -> Find the VM identity you just activated

At the machine:

  1. Install azure cli with
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
@weltonrodrigo
weltonrodrigo / error_470_azure.md
Last active January 10, 2024 15:13
HTTP 470 azure

What is an error with status HTTP 470 on Azure?

This is probably Azure Firewall.

Check the body of the response, it has some debug information:

< HTTP/1.1 470 status code 470
< Date: Sun, 27 Feb 2022 04:29:17 GMT
&lt; Content-Length: 70
@weltonrodrigo
weltonrodrigo / cert-manager-ssl-com.md
Last active December 23, 2022 14:43
How to configure cert-manager to emit certificates from ssl.com?

How to configure cert-manager to emit certificates from ssl.com?

SSL.com has an ACME service for free 90-day ssl certificates.

It's pretty simple to configure cert-manager to use it, you'll need:

  1. A secret containing the HMAC key.
  2. An Issuer or ClusterIssuer configured with your user on ssl.com and their acme url
  3. A ssl.com account

SSL.com ACME credentials

@weltonrodrigo
weltonrodrigo / let's encrypt on rancher using sslip.io domains with azure application gateway.md
Created September 12, 2022 16:31
Who to configure let's encrypt on rancher using sslip.io domains with azure application gateway?

How to configure let's encrypt on rancher using sslip.io domains with azure application gateway?

When using an sslip.io domain on rancher, cert-manager gets in trouble because the hostname won't match.

You need to annotate the ingress with acme.cert-manager.io/http01-edit-in-place=true

@weltonrodrigo
weltonrodrigo / municipios_brasileiros_maiusculas_sem_acento.csv
Last active August 5, 2022 01:33
Lista de municípios brasileiros em maiúsculas sem acentos.
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
nome
ABADIA DE GOIAS
ABADIA DOS DOURADOS
ABADIANIA
ABAETE
ABAETETUBA
ABAIARA
ABAIRA
ABARE
ABATIA
@weltonrodrigo
weltonrodrigo / eventhub-auto-inflate-on-egress.md
Last active July 21, 2022 13:15
Azure eventhub auto-inflates only on ingress, not egress

Does eventhub auto-inflates on egress?

No.


Yeah, that took me a long time.

The ingress rate is what makes the eventhub namespace scale, but not the consumption (the egress). Egress don't get throttled either, you'll have to keep an eye at the rate of consumption and partition limits.

@weltonrodrigo
weltonrodrigo / dive_with_docker_host.md
Last active June 2, 2022 19:20
Using dive with remote docker

Using dive (container explorer tool) with a remote docker

When using DOCKER_HOST with a remote daemon, like DOCKER_HOST=ssh:user@vm:22, you'll get an error when using dive to explore an image.

$ dive ubuntu:latest
Image Source: docker://ubuntu:latest
@weltonrodrigo
weltonrodrigo / AzureMapsTokenController.java
Last active May 12, 2022 13:32
Exemplo de Controller springboot para obter no backend um token do azure maps a ser usado na aplicação javascript.
package br.org.prf.azuremapsexample.controllers;
import com.azure.core.credential.AccessToken;
import com.azure.core.credential.TokenRequestContext;
import com.azure.identity.DefaultAzureCredentialBuilder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;