Skip to content

Instantly share code, notes, and snippets.

View gbaeke's full-sized avatar

Geert Baeke gbaeke

View GitHub Profile
@gbaeke
gbaeke / assistant.py
Last active November 14, 2023 10:01
OpenAI Assistant Demo
import streamlit as st
import openai
import dotenv
from PIL import Image
from io import BytesIO
import os
import pickle
from collections import OrderedDict
@gbaeke
gbaeke / Program.cs
Created May 28, 2023 20:20
Semantic Kernel Demo
using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.AI.ImageGeneration;
using System.Diagnostics;
using Microsoft.SemanticKernel.Planning;
using System.Text.Json;
var kernelSettings = KernelSettings.LoadSettings();
import requests
import json
# url uses a hardcoded identity endpoint
url = "http://127.0.0.1:40342/metadata/identity/oauth2/token?api-version=2019-11-01&resource=https%3A%2F%2Fvault>
headers = {"Metadata": "true"}
# do token request to IMDS, this will fail
r = requests.get(url, headers=headers)
from azure.appconfiguration.provider import (
AzureAppConfigurationProvider,
SettingSelector,
AzureAppConfigurationKeyVaultOptions
)
from azure.keyvault.secrets import SecretClient
from azure.identity import DefaultAzureCredential
def retrieve_secret(uri):
try:
@gbaeke
gbaeke / linkerd-nginx.md
Last active October 12, 2022 03:56
Linkerd with Nginx Ingress

Linkerd with Nginx Ingress

Azure Kubernetes Service

I installed Linkerd and Nginx on an AKS cluster. You will need an Azure subscription and deploy a basic cluster.

Install Linkerd CLI

Install the Linkerd CLI: see https://linkerd.io/2.11/getting-started/#step-1-install-the-cli. You can also install the cli with brew:

@gbaeke
gbaeke / appsvcarc.md
Last active June 19, 2022 16:21
Run Azure App Services anywhere with Azure Arc

Run Azure App Services anywhere with Azure Arc

Prerequisites

All commands in the gist should be run from bash. You can use WSL (Windows Subsystem for Linux) to run the commands. You can also use the Azure Cloud Shell and select Bash instead of PowerShell.

Install Azure CLI (not needed in Azure Cloud Shell, CLI is pre-installed) and add the following Azure CLI extensions:

az extension add --name connectedk8s
@gbaeke
gbaeke / aca-revisions.md
Created January 9, 2022 13:32
Azure Container Apps - Revisions

Azure Container Apps: Revisions

Deploy with Bicep

param image string = 'ghcr.io/gbaeke/super:1.0.5'

resource la 'Microsoft.OperationalInsights/workspaces@2021-06-01' = {
  name: 'la-aca' 
  location: resourceGroup().location
@gbaeke
gbaeke / aca_scaling.md
Last active August 22, 2022 11:57
Azure Container Apps - Bicep and scaling

Azure Container Apps: Bicep and scaling

Azure Service Bus

Create namespace and topic:

az group create --name rg-aca --location northeurope

namespaceName=MyNameSpace$RANDOM
@gbaeke
gbaeke / aca.md
Last active May 26, 2022 11:21
Azure Container Apps

Azure Container Apps

⚠️ IMPORTANT: this is for an older version of Container Apps; although some commands might still work, expect issues

In the video, I did not show all steps:

  • configuring pre-requisites
  • provisioning a Container App Environment

I will use ACA for Azure Container Apps.

resource vnet1 'Microsoft.Network/virtualNetworks@2020-11-01' = {
name: 'vnet1'
location: resourceGroup().location
properties: {
addressSpace: {
addressPrefixes: [
'10.0.10.0/24'
]
}
subnets:[