Skip to content

Instantly share code, notes, and snippets.

@cedriclmenard
cedriclmenard / attribute_method_forwarding.py
Created November 25, 2021 22:16
Python attribute class method forwarding
class A():
def do_stuff(self):
print("done stuff")
def print(self, to_print):
print(to_print)
class B():
def __init__(self):
self.a = A
@cedriclmenard
cedriclmenard / structured_binding.cpp
Created August 7, 2020 02:22
Structured Binding C++ tuple
#include <iostream>
#include <tuple>
using namespace std;
tuple<int, float, string> foo()
{
return {128, 3.142, "Hello"};
}
@cedriclmenard
cedriclmenard / Python.txt
Last active July 28, 2020 20:21
Collection of nice-to-knows on SO
VSCode debugging codes from imported modules: https://stackoverflow.com/questions/53943164/step-debugging-imported-modules-in-python-with-visual-studio-code
cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=/home/nvidia/repos/opencv_contrib/modules/ \
-D WITH_CUDA=ON \
-D WITH_CUDNN=ON \
-D OPENCV_DNN_CUDA=ON \
..
#!/bin/bash
# License: MIT. See license file in root directory
# Copyright(c) JetsonHacks (2017-2018)
OPENCV_VERSION=3.4.1
# Jetson TX2
ARCH_BIN=6.2
# Jetson TX1
# ARCH_BIN=5.3
INSTALL_DIR=/usr/local
@cedriclmenard
cedriclmenard / main.cpp
Created March 5, 2019 23:15
Matrix of fixed size Arrays
//
// main.cpp
// Testing Various Things
//
// Created by Cedric Leblond Menard on 2019-03-05.
// Copyright © 2019 CLM. All rights reserved.
//
#include <iostream>
#include <vector>
@cedriclmenard
cedriclmenard / array_size.cpp
Created March 5, 2019 23:14
Array size constexpr function
template<typename T, unsigned int S>
constexpr unsigned int array_size(T(&v)[S]) {
return S;
}
@cedriclmenard
cedriclmenard / BaseWidget.h
Created February 6, 2019 05:16
Widget with children list
#pragma once
#include <vector>
#include <memory>
class BaseWidget;
typedef std::shared_ptr<BaseWidget> Base_Widget_Ptr;
class BaseWidget {
std::vector<Base_Widget_Ptr> childs_;
@cedriclmenard
cedriclmenard / .gitignore
Last active February 28, 2018 19:56
.gitingore for CPP projects using either CLion or Visual Studio code, or simply using make/cmake
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
@cedriclmenard
cedriclmenard / LockWrap.h
Last active February 13, 2018 20:27
LockWrap - A templated class wrapper to add mutex lock and unlock on each method call (use as a pointer to class, -> to call methods)
//
// Created by cedric on 12/02/18.
// Based off Stroustrup wrapper pattern : http://www.stroustrup.com/wrapper.pdf
//
#ifndef LOCKWRAP_H
#define LOCKWRAP_H
#include <memory>
#include <mutex>