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 / main.go
Last active September 5, 2023 06:37
Go + Fyne + V4L
View main.go
package main
import (
"bytes"
"context"
"image"
"log"
"sync"
_ "image/jpeg"
@metal3d
metal3d / gist:a401d2209e6e2df4cc8c321afd10ef28
Created August 29, 2023 13:43
Scoreboard - Data Confidentiality
View gist:a401d2209e6e2df4cc8c321afd10ef28
Data confidentiality
This application does not store any personal data and consequently does not transmit any data to a third party.
@metal3d
metal3d / Makefile
Created July 11, 2023 13:37
Clean git version in your Makefile
View 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
View grahical-install.sh
#!/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
@metal3d
metal3d / gaussianBlu.go
Created April 13, 2022 17:25
Gaussian filter / blur with Golang
View gaussianBlu.go
package blur
import (
"image"
"image/color"
"image/png"
_ "image/png"
"math"
)
View make_data.py
""" Create dataset """
import os
import uuid
import cv2 as cv
DATA_DIR = "data"
DIRECTIONS = ["up", "down", "right", "left", "neutral"]
@metal3d
metal3d / matrux.sh
Created December 21, 2021 10:14
Matrix in terminal
View matrux.sh
lines=$(tput lines)
cols=$(tput cols)
awkscript='
{
lines=$1
random_col=$3
letter=$4
letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"
letter=substr(letters,letter,1)
@metal3d
metal3d / create-couchbas-pods.sh
Last active December 13, 2021 12:51
Start Couchbase with podman
View create-couchbas-pods.sh
# Configuration
count=4
clustername=mycluster
admin=admin
password=password
networkname=couchbase
volumename=couchbase
# inside the pods, do not change it
@metal3d
metal3d / manual-classification.py
Created June 28, 2021 12:22
Manual classification to a target directory to "good" and "bad" images
View manual-classification.py
""" UI to manually class bad/good images """
import os
import sys
from glob import glob
import cv2 as cv
directory = sys.argv[1]
if not directory:
sys.exit(1)
@metal3d
metal3d / train.py
Created June 28, 2021 12:16
Script to train a binary model to help on creating dataset
View train.py
""" Train model and find bad image from a directory """
import argparse
import os
import time
from glob import glob
from typing import Any
import numpy as np
from tensorflow.python.keras.layers.pooling import MaxPool2D