Skip to content

Instantly share code, notes, and snippets.

@vtalpaert
vtalpaert / optuna_multiprocessing.py
Created October 20, 2023 10:39
This gist is an overcomplicated way to reproduce `study.optimize(objective, n_trials=n_trials, n_jobs=more_than_one)` with CUDA libraries that do not go well with a background thread context. In this case, we use multiprocessing. Useful when you encounter errors such as CUDA_ERROR_ILLEGAL_ADDRESS or CUBLAS_STATUS_NOT_INITIALIZED
import time
import multiprocessing
import optuna
# objective function, returns a score for example
def objective(trial):
return 1
def optimize(study_name, n_trials, sleep):
print(
@vtalpaert
vtalpaert / camera3d.py
Last active March 21, 2022 12:50
Quick script to visualize a depth image from an ASUS Primesense camera for course I gave on March 2022 at ENSTA Paris
"""
camera3d.py
Victor Talpaert 2022
Quick script to visualize a depth image from an ASUS Primesense camera for course I gave on March 2022 at ENSTA Paris
======================
Instructions
# Install dependencies
pip3 install primesense numpy matplotlib opencv-python
@vtalpaert
vtalpaert / iot_mqtt_dancepad.ino
Created January 7, 2021 13:58
Add a DancePad input to your home automation, helps creating cool lighting effects for parties
/*
Add your Wii Dance Dance Revolution Dance Pad Controller as an input to your home automation.
https://en.wikipedia.org/wiki/Dance_pad
For those that want an interactive RGB lights scenery, configure your homeassistant (hass.io)
to change your dancefloor's lighting according to the MQTT signals. Now you are doing your
own light show !
Hardware:
Each dance pad input is a weight sensible resistor. I replaced the original circuit board