Skip to content

Instantly share code, notes, and snippets.

@stgatilov
stgatilov / CMakeLists.txt
Created June 1, 2024 12:37
conan: MSVC runtime settings ignored by FLTK
cmake_minimum_required (VERSION 3.9.6)
project(testapp)
find_package(fltk REQUIRED)
add_executable(testapp test.cpp)
target_link_libraries(testapp fltk::fltk)
@stgatilov
stgatilov / CMakeLists.txt
Created May 26, 2024 20:58
conan libjpeg: WPO on msvc issue
cmake_minimum_required (VERSION 3.9.6)
project(testapp)
find_package(fltk REQUIRED)
add_executable(testapp test.cpp)
target_link_libraries(testapp fltk::fltk)
@stgatilov
stgatilov / numba_cuda_opengl.py
Created May 10, 2024 16:23
numba.cuda: device buffer shared with OpenGL
import ctypes
import numpy as np
import numba.cuda as cuda
import cuda.cudart as curt
# source: https://numba.discourse.group/t/cuda-opengl-interop/1898
class OpenglBufferInCuda:
"""A mapping of OpenGL buffer into CUDA device memory."""
def __init__(self, glbuf):
@stgatilov
stgatilov / bloatinfo.py
Last active January 22, 2019 06:15
SymbolSort runner script
#!python3
import os, sys, glob, re, argparse, shutil
from os import path
# Note: Python 3.5 or later is required !
def concat_files(in_files, out_file):
with open(out_file, 'wb') as wfd:
for f in in_files:
with open(f, 'rb') as fd:
shutil.copyfileobj(fd, wfd, 1024*1024*10)
@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 =========================
@stgatilov
stgatilov / intrusive.cpp
Last active December 31, 2016 10:56
Intrusive shared_ptr with weak_ptr (prototype)
#include <stddef.h>
#include <stdio.h>
#include <assert.h>
#include <algorithm>
#ifndef NO_CPP11
#include <type_traits>
#endif
// This is a prototype of intrusive SharedPtr + WeakPtr combo.
// It is not thread-safe yet, and it relies on rather unsafe things.