Skip to content

Instantly share code, notes, and snippets.

View saracen24's full-sized avatar
🏴‍☠️

Aiz saracen24

🏴‍☠️
View GitHub Profile
@saracen24
saracen24 / dict_to_class.py
Created May 28, 2024 13:43
Convert a dict of any depth to a class.
from typing import Any, Dict, FrozenSet, List, Set, Tuple, Union
class DictToClass:
"""Convert a dict of any depth to a class."""
def __init__(self, data: Dict) -> None:
for name, value in data.items():
setattr(self, name, self.__expand(value))
@saracen24
saracen24 / thread_safe_queue.hpp
Created November 12, 2021 09:18
C++17 thread safe queue adaptor with std::queue interface. The second template parameter defines the type of the sequence container that supports front, back, push_back, and pop_front (like std::deque, std::list, etc.).
/**
* @file thread_safe_queue.hpp.
* @brief Thread safe queue.
* @author Aiz (c).
* @date 2021.
*/
#pragma once
#include <mutex>
#include <queue>
@saracen24
saracen24 / logging_extentions.py
Last active June 28, 2024 18:57
Python colorized console and daily logging with tqdm output support.
# ------------------------------------------------------------------------------
# -
# Python dual-logging setup (console and daily logfile), -
# supporting different log levels, tqdm and colorized output. -
# -
# Based on: -
# https://gist.github.com/fonic/7e5ab76d951a2ab2d5f526a7db3e2004 -
# -
# ------------------------------------------------------------------------------
@saracen24
saracen24 / build_opencv_v142_x64.cmd
Last active December 20, 2020 17:20
Build OpenCV with contrib and CUDA 11 in Windows. CMake, Microsoft Visual Studio 2019 and vswhere required.
:: Possible configuration (contrib, cuda, openvino):
:: NVidia CUDA Toolkit
:: NVidia cuDNN
:: Intel C++ Compiler Redistributable Libraries
:: Intel MKL
:: Intel TBB
:: Intel OpenVINO toolkit
::
:: Current configuration (contrib, cuda):
:: NVidia CUDA Toolkit 11.1.1
@saracen24
saracen24 / build_opencv_ninja.sh
Last active December 18, 2020 17:58
Build OpenCV with contrib and CUDA 11 in Linux. CMake and Ninja build system required.
#!/bin/bash
# Possible configuration (contrib, cuda, openvino):
# NVidia CUDA Toolkit
# NVidia cuDNN
# Intel C++ Compiler Redistributable Libraries
# Intel MKL
# Intel TBB
# Intel OpenVINO toolkit
#