Skip to content

Instantly share code, notes, and snippets.

View snobu's full-sized avatar

Adrian Calinescu snobu

View GitHub Profile
@snobu
snobu / image_to_base64.py
Created June 3, 2024 13:14
Image to base64
# Open the image file and encode it as a base64 string
def encode_image(image_path):
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode("utf-8")
base64_image = encode_image(IMAGE_PATH)
@snobu
snobu / WebApiConfig.cs
Created September 7, 2023 11:55
Dynamic CORS policy update for ASP.NET (.NET Framework)
using System;
using System.Configuration;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Cors;
using System.Web.Http;
using System.Web.Http.Cors;
using System.IO;
using Microsoft.Azure.Storage;
using Microsoft.Azure.Storage.Blob;
@snobu
snobu / unified.html
Last active January 19, 2023 11:28
AAD B2C login template
<!DOCTYPE html>
<html>
<head>
<title>App Login</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
@snobu
snobu / get_latest_release_ver_from_GitHub.sh
Created September 8, 2022 13:38
Get latest release version for GitHub repo
curl -s https://api.github.com/repos/cert-manager/cert-manager/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
@snobu
snobu / install.md
Last active May 6, 2022 08:45
Install Kubeflow on AKS (k8s v1.21.7)

Kubeflow on AKS - Project KFC

image

Deploy k8s cluster v1.21.7 or lower, but not lower than v1.20.

Clone the manifests repo -

$ git clone -b master https://github.com/kubeflow/manifests

Download and run kustomize v3. NOTE v4 won’t work with current (v1.5) Kubeflow.

@snobu
snobu / Notes.md
Created February 8, 2022 11:36
Kube Network Notes
  • Containers in a pod share namespaces among them.

  • Container-to-Container comms via localhost (because they share the same kernel namespace)

  • The 'pause' container (AKA infra container) is a container which holds the network namespace for the pod. Kubernetes creates pause containers to acquire the respective pod’s IP address and set up the network namespace for all other containers that join that pod. It has one job: DON'T DIE.

@snobu
snobu / Program.cs
Created December 13, 2021 12:42
Use Managed Identity to access Azure SQL
using System;
using System.Data.SqlClient;
using System.Threading.Tasks;
using Azure.Identity;
using Azure.Core;
namespace NET47ManagedIdentitytoAzureSQL
{
class MainClass
{
@snobu
snobu / temp_control.py
Last active October 25, 2021 17:06
PySimpleGUI Thermostat example
#!/usr/bin/env python3
import PySimpleGUI as sg
def read_temp1():
return 24.0
def read_temp2():
return 21.1
@snobu
snobu / defaultServiceVersion.md
Created September 28, 2021 19:28
Set Azure Blob Storage default API version (defaultServiceVersion)
PowerShell> Update-AzStorageBlobServiceProperty -DefaultServiceVersion 2017-07-29 -resourcegroupname bonsai-rg-bonsai-025b200c-f80c-46df-98e5-01e49c78aed6 -StorageAccountName bonsai26 -Debug


HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/bonsai-rg-bonsai-025b200c-f80c-46df-98e5-01e49c78aed6/providers/Microsoft.Storage/storageAccounts/bonsai26/blobServices/default?api-version=2021-04-01
@snobu
snobu / gist:b04f5ec8c7a34f9443f36db645d69581
Created September 17, 2021 09:07
Microsoft Forms API
https://forms.office.com/formapi/api/forms/v4j5cvGF_ORMS_ID_MUDBWQS4u/responses