Skip to content

Instantly share code, notes, and snippets.

View clemlesne's full-sized avatar

Clémence Lesné clemlesne

View GitHub Profile
@clemlesne
clemlesne / aks_log_consumption.md
Last active May 9, 2024 03:14
Extract Azure Monitor consumption by Azure Kubernetes Service Pod labels

Run this command against your Azure Monitor logs:

ContainerLog
  | where TimeGenerated >= ago(360d)
  | project TimeGenerated, ContainerID, _BilledSize
  | lookup kind=leftouter (
      KubePodInventory
        | where TimeGenerated >= ago(360d)
 | sort by TimeGenerated desc
@clemlesne
clemlesne / prompt-meeting-summary.md
Last active March 15, 2024 15:25
LLM prompt to summarize a meeting

You are an executive assistant with 20 years of experience.

Context

Assistant is working in an IT company.

Objective

Summarize a meeting transcript. The Transcript has been automatically generated by Teams.

Rules

  • Cite people for each main points
@clemlesne
clemlesne / create-users.sh
Created February 8, 2024 17:21
Add users to Azure Entra ID and add them to a group, in a batch.
#!/usr/bin/bash
CSV_FILE="users.csv"
# Skip the header line
tail -n +2 "$CSV_FILE" | while IFS=',' read -r first_name last_name hackaton_group_number first_password
do
# Create the user in Azure AD, make sure the user principal name is in lowercase
display_name="$first_name $last_name"
user_principal_name="$(echo $first_name.$last_name | tr '[:upper:]' '[:lower:]')@XPBDF.onmicrosoft.com"
@clemlesne
clemlesne / mermaid-export.sh
Last active November 20, 2023 10:26
Convert a locally a Mermaid diagram to a HiDPI image, ready to use
#!/bin/bash
# Function to check if a command exists
command_exists () {
type "$1" &> /dev/null ;
}
mermaid_cli() {
npx --yes @mermaid-js/mermaid-cli $@
}
@clemlesne
clemlesne / video-opt.sh
Created November 16, 2023 13:17
Easiliy optimize videos with FFMPEG from a folder
# Iterate over MP4, MOV and M4V files in the directory
find "." -type f \( -iname "*.mp4" -o -iname "*.MP4" -o -iname "*.mov" -o -iname "*.MOV" -o -iname "*.m4v" -o -iname "*.M4V" \) -exec sh -c '
for file do
echo "Optimizing: $file"
# Extract the file extension
EXT="${file##*.}"
# Generate a random file name for the temporary file, preserving the extension
TMP_FILE="/tmp/optimized.$RANDOM.$EXT"
@clemlesne
clemlesne / openai-azure-ad-wrapper.py
Last active November 10, 2023 10:33
OpenAI SDK wrapper for Azure AD authentications
from azure.identity import DefaultAzureCredential
from typing import Awaitable
import asyncio
import openai
# Set up the Azure credential
credential = DefaultAzureCredential()
def openai_refresh() -> None:
"""
@clemlesne
clemlesne / convert.sh
Created November 7, 2023 15:20
Make transaprent and crop an image
#!/bin/bash
# Display help with -h parameter
function display_help {
echo "Usage: $0 -i <image-path>"
echo
echo " -h Display this help message."
echo " -i <image-path> Specify the image path for processing."
echo
exit 1
---
title: Deployment workflow
---
flowchart LR
    dev(["Developer"])

    subgraph azdo["Azure DevOps"]
        repo["Azure Repos"]
        pipeline["Azure Pipelines"]
@clemlesne
clemlesne / strip.py
Created September 18, 2023 17:05
Takes a raw string of HTML and removes all HTML tags, Markdown tables, and line returns.
from typing import Optional
import re
import html
def sanitize(raw: Optional[str]) -> Optional[str]:
"""
Takes a raw string of HTML and removes all HTML tags, Markdown tables, and line returns.
"""
if not raw:
@clemlesne
clemlesne / openai.svg
Created August 31, 2023 08:49
OpenAI SVG icon
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.