Skip to content

Instantly share code, notes, and snippets.

IDENTIFICATION DIVISION.
PROGRAM-ID. traingle.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 GL_COLOR_BUFFER_BIT USAGE BINARY-INT UNSIGNED VALUE 16384.
01 GL_VERSION USAGE BINARY-INT UNSIGNED VALUE 7938.
01 GL_STATIC_DRAW USAGE BINARY-INT UNSIGNED VALUE 35044.
01 GL_ARRAY_BUFFER USAGE BINARY-INT UNSIGNED VALUE 34962.
@milasudril
milasudril / multi_array.hpp
Created August 6, 2022 10:18
Structure of array class
#include <tuple>
#include <cstddef>
#include <memory>
#include <span>
#include <algorithm>
template<size_t I = 0, class... Tp, class F>
void for_each_apply(std::tuple<Tp...>& t, F&& f)
@milasudril
milasudril / sources.list
Last active August 2, 2022 20:06 — forked from ExaByt3s/sources.list
apt repository list for Linux Mint Vanessa
deb http://packages.linuxmint.com vanessa main upstream import backport #id:linuxmint_main
deb http://archive.ubuntu.com/ubuntu jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
@milasudril
milasudril / plot.hpp
Created July 31, 2022 19:04
Simple gnuplot interface
#include <span>
#include <memory>
#include <stdexcept>
#include <algorithm>
using vec2_t [[gnu::vector_size(8)]] = float;
struct pipe_closer
{
void operator()(FILE* f) const
@milasudril
milasudril / command_line.hpp
Created May 21, 2022 08:36
Simple dd style command line parser
#include <map>
#include <string>
#include <algorithm>
/**
* Accepts a `dd` style (foo=bar) command line. For simplicity it has
* no support parameter descriptions.
*/
class command_line
{
@milasudril
milasudril / wordgetn.cpp
Last active December 21, 2021 19:33
Generate some words
//@ {"target":{"name":"wordgen.o"}}
#include <random>
#include <string>
#include <map>
#include <set>
#include <cstdio>
#include <optional>
#include <cuchar>
#include <climits>
@milasudril
milasudril / cxx_env.py
Created March 23, 2021 20:35
Expose host environment variables to C++ compiler
#!/usr/bin/env python3
import os
import json
import string
import tempfile
import subprocess
import sys
cxx_template = string.Template('''#ifndef COMPILE_ENV_INCLUDED
@milasudril
milasudril / blender_export_helper.py
Created February 13, 2021 14:22
Helper for exporting blender meshes
import bmesh
import bpy
import json
def debug_print(data):
for window in bpy.context.window_manager.windows:
screen = window.screen
for area in screen.areas:
if area.type == 'CONSOLE':
override = {'window': window, 'screen': screen, 'area': area}
@milasudril
milasudril / variant_from_enum.hpp
Created October 23, 2020 19:59
Make variant from enum
#include <variant>
#include <type_traits>
namespace Library
{
template<class T>
using Empty = std::type_identity<T>;
namespace detail
{
@milasudril
milasudril / projhull.py
Last active January 31, 2017 17:13
Projected convex hull
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the