Skip to content

Instantly share code, notes, and snippets.

View Morwenn's full-sized avatar
🏳️‍🌈
(∩ᄑ_ᄑ)⊃━☆゚。・:*:・゚’★,。・:*:・゚’☆

Morwenn Morwenn

🏳️‍🌈
(∩ᄑ_ᄑ)⊃━☆゚。・:*:・゚’★,。・:*:・゚’☆
  • Brittany
View GitHub Profile
@giraldeau
giraldeau / CMakeLists.txt
Created November 3, 2017 21:48
The missing example to use cmake qt5_create_translation
cmake_minimum_required(VERSION 3.8)
project(tsProject)
# Managing translations require LinguistTools module
# The cmake function is defined in the Qt installation tree:
# i.e. Qt5.9.1/5.9.1/gcc_64/lib/cmake/Qt5LinguistTools/Qt5LinguistToolsMacros.cmake
# Reference: https://doc.qt.io/qt-5/cmake-manual.html#qt5linguisttools-macros
find_package(Qt5 COMPONENTS Widgets LinguistTools)
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@stgatilov
stgatilov / gen.cpp
Created August 2, 2017 16:12
Vectorizing std::merge with vpermd from AVX2 and lookup table
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <assert.h>
#include <stdint.h>
#include <algorithm>
#include <vector>
//======================== Perfect hash generator =========================
@CaseyCarter
CaseyCarter / rotate_no_gcd.cpp
Last active November 18, 2020 15:17
Like rotate_gcd, but calculates the gcd by traversing the first cycle.
#include <cassert>
#include <iterator>
#include <numeric>
#include <utility>
#ifndef NDEBUG
#include <cassert>
#define EXPECT(...) assert(__VA_ARGS__)
#else
#ifdef __clang__
@lukas-h
lukas-h / license-badges.md
Last active April 14, 2025 17:15
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)

@thriveth
thriveth / CBcolors.py
Created January 22, 2014 14:52
A color blind/friendly color cycle for Matplotlib line plots. Might want to shuffle it around a bit more,but already not it gives kinda good contrasts between subsequent colors, and shows reasonably well in colorblind filters (though not in pure monochrome).
CB_color_cycle = ['#377eb8', '#ff7f00', '#4daf4a',
'#f781bf', '#a65628', '#984ea3',
'#999999', '#e41a1c', '#dede00']
@igniteflow
igniteflow / env-context.py
Last active December 12, 2023 16:43
A Python context manager for setting/unsetting environment variables
from contextlib import contextmanager
"""
Usage:
with env_var('MY_VAR', 'foo'):
# is set here
# does not exist here
"""
@remram44
remram44 / QtWrapper.py
Created July 12, 2013 16:17
PySide/PyQt4 abstraction module
"""Adapted from http://askubuntu.com/a/141641
This compatibility layer allows to use either PySide or PyQt4 as the Qt
binding. It will choose what's available, defaulting on PySide, unless the
QT_API environment variable is set.
"""
import os
import sys
@lorenzoriano
lorenzoriano / linspace.cpp
Last active June 4, 2024 14:29 — forked from jmbr/linspace.cpp
C++ Analogous of Python linspace, returns a std::vector
template <typename T>
std::vector<T> linspace(T a, T b, size_t N) {
T h = (b - a) / static_cast<T>(N-1);
std::vector<T> xs(N);
typename std::vector<T>::iterator x;
T val;
for (x = xs.begin(), val = a; x != xs.end(); ++x, val += h)
*x = val;
return xs;
}