Skip to content

Instantly share code, notes, and snippets.

View clemlesne's full-sized avatar

Clémence Lesné clemlesne

View GitHub Profile
@clemlesne
clemlesne / enum.py
Last active February 24, 2025 10:06
Embed documentation, pretty name, and value, in a native Python enum that can still be serialized with Pydantic.
from enum import StrEnum
def main() -> None:
print(MyEnum.INFRASTRUCTURE_AS_CODE)
print(str(MyEnum.INFRASTRUCTURE_AS_CODE))
print(MyEnum.INFRASTRUCTURE_AS_CODE.__doc__)
class StrEnumWithDocstring(StrEnum):
@clemlesne
clemlesne / backlog-prompt.md
Created February 14, 2025 11:28
Technical product backlog item LLM prompt
You are to draft a software issue in English using markdown with bullet points. Follow this structure:

1. **Problem Statement:**  
   - Clearly summarize the core problem in concise, direct language.
   - Focus on the essential issues (e.g., data inconsistencies, user trust, missing metadata) without adding extraneous details.

2. **Proposed Solution(s):**  
   - List one or more concrete solutions.
   - For each solution, briefly outline its main benefits and drawbacks.
@clemlesne
clemlesne / redis_bytes_io.py
Last active February 21, 2025 19:00
Stream a blob with the native BytesIO and AsyncIterable Python interfaces, from async Redis.
import asyncio
import io
from asyncio import AbstractEventLoop
from collections.abc import AsyncGenerator, Awaitable, Buffer
from contextlib import asynccontextmanager
from logging import getLogger
from os import environ as env
from threading import Thread
from typing import TypeVar, cast
@clemlesne
clemlesne / meeting-transcript-shortcut.md
Last active November 14, 2024 13:00
A shortcut for macOS/iOS to make meeting transcripts

Meeting transcription

To be used with macOS/iOS Shortcut app.

Install link for v0.2.0.

Features

  • Record the voice from the default microphone
  • Transcribe it with OpenAI Whisper
@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 / 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 / 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 / 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