Skip to content

Instantly share code, notes, and snippets.

View Bemesko's full-sized avatar
🐧
Programming (probably)

Bernardo Mesko Bemesko

🐧
Programming (probably)
View GitHub Profile
@Bemesko
Bemesko / agentes_calculadoras.py
Created September 30, 2020 18:11
Pequeno experimento com osBrain para criar uma calculadora; Espera entradas no formato "1 + 1"
from osbrain import run_agent
from osbrain import run_nameserver
def somar(agent, message):
# Separar números e operador em uma lista
operadores = message.split()
# Checar se a operação desejada é uma soma
if operadores[1] == "+":
@Bemesko
Bemesko / fizzbuzz.py
Created October 15, 2020 03:20
Fizzbuzz de praticamente 1 linha usando geradores e operadores ternários!
def fizz_buzz():
num = -1
while num < 100:
num += 1
yield f"{num} {'fizz' if num % 3 == 0 else ''}{'buzz' if num % 5 == 0 else ''}"
for i in fizz_buzz():
print(i)
@Bemesko
Bemesko / copy-database.ps1
Created June 13, 2023 21:17
Clone a template database in Azure using the Azure CLI
$resourceGroupName = "poc-database-script-rg"
$serverName = "berb-database-poc"
$databaseName = "source-database"
$newDatabaseName = "copy-database-cli"
az sql db copy `
--dest-name $newDatabaseName `
--dest-resource-group $resourceGroupName `
--dest-server $serverName `
--name $databaseName `