Skip to content

Instantly share code, notes, and snippets.

#include <QApplication>
#include <QThread>
#include <memory>
#include <iostream>
#define USE_UNIQUE_PTR
template<typename T, typename ...Args>
std::unique_ptr<T> make_unique( Args&& ...args )
{
@landersson
landersson / mkrgbhex.py
Created March 7, 2018 03:52
rgbhex test data generator
#!/usr/bin/env python3
import os
import subprocess
url = "https://raw.githubusercontent.com/altercation/vim-colors-solarized/"\
"master/colors/solarized.vim"
outfile = "rgbhex-test-data.txt"
megabytes = 256
assert not os.path.isfile(outfile)
@landersson
landersson / cfg.sh
Last active January 26, 2021 12:27
# curl -# -L https://gist.githubusercontent.com/landersson/2ad0a7352d597e5ef3032b3bf1eaea22/raw | bash
function config {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
}
REPO_METHOD=${1:-"git"}
if [[ $REPO_METHOD == "git" ]]; then
REPO_URL="git@github.com:landersson/cfg.git"
elif [[ $REPO_METHOD == "http" ]]; then
#include <mqtt/client.h>
#include <mqtt/callback.h>
#include <string>
struct MqttConnection : public mqtt::callback {
bool connect();
bool disconnect();
bool transmit(const mqtt::message_ptr msg);
// mqtt::callback functions
@landersson
landersson / test_cudaGLGetDevices.cu
Created February 1, 2023 03:43
Test case for bug in cudaGLGetDevices
#include <GLFW/glfw3.h>
#include <cuda_gl_interop.h>
#include <cuda.h>
#include <cstdio>
int main()
{
if (!glfwInit()) return;
@landersson
landersson / test_egl.cc
Created February 1, 2023 05:55
Simple EGL offscreen rendering test code
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <malloc.h>
#include <EGL/egl.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#include <GL/glext.h>