Skip to content

Instantly share code, notes, and snippets.

View OlivierLDff's full-sized avatar

Olivier Le Doeuff OlivierLDff

View GitHub Profile
@OlivierLDff
OlivierLDff / FindTensorRT.cmake
Last active March 20, 2023 08:47
FindTensorRT.cmake for find_package(TensorRT)
# ~~~
# Copyright 2021 Olivier Le Doeuff
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
@OlivierLDff
OlivierLDff / Readme.md
Last active April 14, 2024 09:19
🚀 Git Bash Emojis (Windows)

Open git bash with admin privilege.

cd "C:/Program Files/Git/usr/share/mintty"
mkdir -p emojis
cd emojis
curl https://raw.githubusercontent.com/wiki/mintty/mintty/getemojis > getemojis
./getemojis -d
@OlivierLDff
OlivierLDff / getpip.py
Created January 19, 2021 14:30
getpip.py
This file has been truncated, but you can view the full file.
#!/usr/bin/env python
#
# Hi There!
# You may be wondering what this giant blob of binary data here is, you might
# even be worried that we're up to something nefarious (good for you for being
# paranoid!). This is a base85 encoding of a zip file, this zip file contains
# an entire copy of pip (version 20.2.4).
#
# Pip is a thing that installs packages, pip itself is a package that someone
# might want to install, especially if they're looking to run this get-pip.py
@OlivierLDff
OlivierLDff / ClipRRect.qml
Created November 27, 2020 12:47
An item that clips its child using a rounded rectangle.
// MIT License
//
// Copyright (c) 2020 Olivier Le Doeuff
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@OlivierLDff
OlivierLDff / Dockerfile
Created October 9, 2020 11:40
Docker : Build cmake
# Build cool cmake version
ARG CMAKE=3.18.4
RUN wget -c -nv https://github.com/Kitware/CMake/releases/download/v${CMAKE}/cmake-${CMAKE}.tar.gz && \
tar zxvf cmake-${CMAKE}.tar.gz && \
rm -rf cmake-${CMAKE}.tar.gz && \
cd cmake-${CMAKE} && \
./configure && \
make -j $(nproc) && \
make install && \
@OlivierLDff
OlivierLDff / Dockerfile
Last active October 9, 2020 13:43
Docker/Ubuntu14 : Update to gcc 7/8/9
FROM ubuntu:trusty
ARG GCC=9
RUN apt-get install -y software-properties-common && \
add-apt-repository ppa:ubuntu-toolchain-r/test && \
apt-get update && \
apt-get -y install g++-${GCC} && \
update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-${GCC} 60 \
void loggingMessageHandler(QtMsgType type, const QMessageLogContext & context, const QString & msg)
{
QString timeStr(QDateTime::currentDateTime().toString("dd-MM-yy HH:mm:ss:zzz"));
QString contextString(QString("[%1 %2]").arg(context.file).arg(context.line));
mutex.lock();
QString level;
if(logFile.isOpen())
{
@OlivierLDff
OlivierLDff / cmake3.17.docker.sh
Created May 3, 2020 07:07
Install cmake 3.17 in docker
#!/bin/bash
wget -qO- "https://cmake.org/files/v3.17/cmake-3.17.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local
#include <chrono>
#include <cstdint>
std::uint64_t now() const
{
const auto timeNow = std::chrono::system_clock::now();
const auto timeMs = std::chrono::duration_cast<std::chrono::milliseconds>(timeNow.time_since_epoch());
const auto timestamp = timeMs.count();
return timestamp;
}
template <typename T>
class BitField
{
T _flags = 0;
public:
constexpr bool empty() const { return _flags == 0; }
constexpr bool isFlagPresent(const T flag) const { return _flags & T(1 << flag); }
constexpr void setFlag(const T flag) { _flags |= T(1 << flag); }
constexpr void clearFlag(const T flag) { _flags &= ~T(1 << flag); }
constexpr void clear() { _flags = 0; }