Skip to content

Instantly share code, notes, and snippets.

View metal3d's full-sized avatar
Electrifying my brain

Patrice Ferlet metal3d

Electrifying my brain
View GitHub Profile
@metal3d
metal3d / PythonDIArticle.md
Last active April 23, 2024 15:37
Python DI

Python et l'injection de dépendance

Ah, ça... quand on parle d'injection et de dépendance, on s'attend tout de suite à se prendre une flopée de visiteurs en manque de substance plus ou moins illicites. En réalité, on va parler "pattern". Et surtout, je vais lancer un vieux pavé dans la marre en disant qu'en Python c'est pas super utile, ou du moins que le langage permet déjà de le gérer sans se faire mal.

Piqure de rappel

Conversation un matin au travail:

@metal3d
metal3d / Pipfile
Created March 13, 2024 08:09
Generate French products in JSON with AI, using LM Studio or OpenAI
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
openai = "*"
rich = "*"
[dev-packages]
@metal3d
metal3d / Info
Created June 16, 2021 06:47
Countries coordinates with longitude and latitude
Based on https://gist.github.com/tadast/8827699:
- remove duplicates
- striped and no unecessary double quotes
- floating point values instead of strings
@metal3d
metal3d / main.go
Last active September 5, 2023 06:37
Go + Fyne + V4L
package main
import (
"bytes"
"context"
"image"
"log"
"sync"
_ "image/jpeg"
@metal3d
metal3d / gist:a401d2209e6e2df4cc8c321afd10ef28
Created August 29, 2023 13:43
Scoreboard - Data Confidentiality
Data confidentiality
This application does not store any personal data and consequently does not transmit any data to a third party.
@metal3d
metal3d / gh_latest.go
Last active August 14, 2023 06:10
Go client to github to get latest release and assets for a given repository
package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
@metal3d
metal3d / videoframegenerator.py
Last active August 7, 2023 10:24
A video frame generator respecting Keras.Sequence class with data augmentation capacities
# DEPRECATED - please go to my complete package:
# pipy package https://pypi.org/project/keras-video-generators/
# github sources https://github.com/metal3d/keras-video-generators
import keras
import cv2 as cv
import glob
import numpy as np
import os
import random
@metal3d
metal3d / videoframegenerator.py
Created April 2, 2019 12:16
A video frame generator respecting Keras.Sequence class with data augmentation capacities
import keras
import cv2 as cv
import glob
import numpy as np
import os
import random
import keras_preprocessing
# author: Patrice Ferlet <patrice.ferlet@smile.fr>
# licence: MIT
@metal3d
metal3d / Makefile
Created July 11, 2023 13:37
Clean git version in your Makefile
# Get the current clean version from your git repo
# - -tagname if the current commit is tagged and no changes were detected
# - branchname-sha if not
# - branchname-sha-dirty if changes were detected and not commited
# Use $(VERSION) to get it, wherever you want in your commands
VERSION=$(shell \
git describe --exact-match --tags --dirty 2>/dev/null || \
printf "%s-%s%s" \
$(shell git branch --show-current) \
$(shell git log -n1 --pretty=%h) \
@metal3d
metal3d / grahical-install.sh
Last active June 9, 2023 12:45
Create kind cluster + projectcontour ingress controller
#!/bin/bash
# Check helm, kubectl and kind
NEEDED=""
for cmd in helm kubectl kind pkexec; do
if ! command -v $cmd >/dev/null 2>&1; then
NEEDED="$NEEDED $cmd"
fi
done
if [ -n "$NEEDED" ]; then