Skip to content

Instantly share code, notes, and snippets.

Avatar
Electrifying my brain

Patrice Ferlet metal3d

Electrifying my brain
View GitHub Profile
@metal3d
metal3d / gaussianBlu.go
Created Apr 13, 2022
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 Dec 21, 2021
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 Dec 13, 2021
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 Jun 28, 2021
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 Jun 28, 2021
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
@metal3d
metal3d / Info
Created Jun 16, 2021
Countries coordinates with longitude and latitude
View Info
Based on https://gist.github.com/tadast/8827699:
- remove duplicates
- striped and no unecessary double quotes
- floating point values instead of strings
View make editable vars in html.html
<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 / sun_set.py
Last active Oct 14, 2020
Align Sky textyure with the sun lamp in Blender
View sun_set.py
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"
@metal3d
metal3d / videoframegenerator.py
Last active Mar 18, 2021
A video frame generator respecting Keras.Sequence class with data augmentation capacities
View videoframegenerator.py
# 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