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 / generator.py
Last active December 7, 2022 22:41
Keras generator to create sequence image batches
import cv2 as cv
import os
import glob
import numpy as np
import random
from tensorflow import keras
import keras.preprocessing.image
from tensorflow.python.keras.utils.data_utils import Sequence
class VideoFrameGenerator(Sequence):
@metal3d
metal3d / gaussianBlu.go
Created April 13, 2022 17:25
Gaussian filter / blur with Golang
package blur
import (
"image"
"image/color"
"image/png"
_ "image/png"
"math"
)
""" 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
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
# 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
""" 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
""" 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
<html>
<meta charset="utf-8" />
<body>
<pre>
<code>
# All you have to do is to prefix variables with "_change_"
# and let the script to manage the editable values
FOO="_change_thisvariable"
this is a command with _change_argument here
@metal3d
metal3d / nat-traversal.js
Created August 9, 2011 22:16
NAT Traversal with node (0.5.x)
/*
NAT traversal system to let 2 computers behind firewall to communicate.
Example:
Client A (your machine) has public ip 1.1.1.1
Client B (distant machine) has public ip 2.2.2.2
You want to bind port 5556 on your machine
Distant Client want to bind port 5557
@metal3d
metal3d / sun_set.py
Last active October 14, 2020 07:35
Align Sky textyure with the sun lamp in Blender
import bpy
import mathutils
# Author: Patrice Ferlet <metal3d@gmail.com>
# License: GPL
# Works with Blender 2.80-2.90
# To use this script:
# - paste this script in a "text editor" *inside* blender
# - name it "sun_set.py"