Skip to content

Instantly share code, notes, and snippets.

@gxara
gxara / setup_az_devops_var_group.sh
Last active July 5, 2023 19:40
Setup azure devops env vars from CSV
printf "\n\n**** Setting up AZ DEVOPS env vars *****\n\n"
az login
read -p "- Type the project name: " PROJECT
read -p "- Type the group name: " GROUP_NAME
read -p "- Type the name of the comma separated file with envs and values: " FILE_NAME
az devops configure -d project=$PROJECT
GROUP_ID=$(az pipelines variable-group list --group-name $GROUP_NAME --query '[0].id')
awk -v GROUP_ID=$GROUP_ID -v PROJECT=$PROJECT --field-separator="," '{ print "az pipelines variable-group variable create --group-id ",GROUP_ID," --project",PROJECT," --name ",$1,"--value ",$2,";" }' $FILE_NAME >> command.sh
printf "\n**** Done! Commands saved at commands.sh****\n\n"
@gxara
gxara / flask_with_background_processing_example.py
Created November 3, 2021 02:22
Exemplo de processamento assíncrono com Flask e multiprocessing
from flask import Flask, current_app
from multiprocessing import Queue, Process
import time
def slow_job_to_be_processed_async(fifo):
while True:
seconds_to_sleep = int(fifo.get())
print(
f"Gabriel salvando indicação de modelo no BD... Vai levar {seconds_to_sleep} segundos")