Skip to content

Instantly share code, notes, and snippets.

View bisqwit's full-sized avatar

Joel Yliluoma bisqwit

View GitHub Profile
@bisqwit
bisqwit / Portal 2 map merger
Last active August 29, 2015 13:56
Portal 2 Puzzlemaker Map Merger. It combines two maps into one map. You will need the PHP interpreter commandline version to run it (/usr/bin/php).
<?php
/* PORTAL 2 PUZZLEMAKER MAP MERGER - VERSION 1.0.0 (2014-02-20)
* COPYRIGHT (C) 2013,2014 Joel Yliluoma - http://iki.fi/bisqwit/
* Source code license: MIT
*/
/* PUT YOUR SETTINGS HERE: */
// Filenames for the input and output maps
@bisqwit
bisqwit / sparc64.cc
Created March 5, 2014 18:45
Sparc64 emulator WIP (from 2011)
#include <stdint.h>
#include <stdio.h>
#include <cstring>
#include <string>
#include <map>
#include <vector>
#include <cmath>
@bisqwit
bisqwit / vbsp_bisqwit.cc
Last active June 24, 2018 14:44
Rewriting vbsp_styles (Portal 2 Puzzlemaker BEE2)
/* TO COMPILE:
*
i686-w64-mingw32-g++.exe -o vbsp_bisqwit.exe vbsp_bisqwit.cc -Wall -Wextra -pedantic -Ofast -static -flto -s -std=gnu++1y -fopenmp
OR:
x86_64-w64-mingw32-g++.exe -o vbsp_bisqwit.exe vbsp_bisqwit.cc -Wall -Wextra -pedantic -Ofast -static -flto -s -std=gnu++1y -fopenmp
OR
@bisqwit
bisqwit / blocksetting.hh
Last active August 29, 2015 14:01
Scoped temporary values
/**
*
* Block-local temporaries
*
* Copyright (C) 2006,2014 Bisqwit (http://iki.fi/bisqwit/)
*
* Example use:
* bool in_critical_context = false;
*
* void example()
/**
* Mandelbrot fractal portable SIMD calculation core
* Copyright (c) 2017 Joel Yliluoma (http://iki.fi/bisqwit/)
*/
#include <array>
#include <cmath>
/*
* SIMDMandelCalculator template:
*
* T is the underlying (real) numeric type, with which the calculations
@bisqwit
bisqwit / transform_iterator.hh
Last active February 3, 2019 18:58
Add another example
#include <memory>
#include <iterator>
#include <typeindex>
/* Tiny transform_iterator for C++. Copyright 2018 © Joel Yliluoma - http://iki.fi/bisqwit/
* License: MIT
Example WITHOUT transform_iterator:
template<typename Func>
@bisqwit
bisqwit / textbox.hh
Last active October 23, 2024 18:58
Abstraction for 2-dimensional text strings with VT100 linedrawing support; and a tree structure visualizer function
#include <string>
#include <vector>
#include <algorithm>
/* textbox: Abstraction for 2-dimensional text strings, with VT100 linedrawing support */
/* Copyright (c) 2017 Joel Yliluoma - http://iki.fi/bisqwit/ */
/* License: MIT */
/* Requires a C++17 capable compiler and standard library. */
struct textbox
{
@bisqwit
bisqwit / runXterm.cc
Created October 5, 2017 06:54
My Xterm launcher script
#include <vector>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <unistd.h>
#include <cstdio>
using namespace std;
/* saturation, value and hue all are 0..1 */
@bisqwit
bisqwit / .bashrc
Created October 5, 2017 06:55
From .bashrc
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
@bisqwit
bisqwit / clamp_with_desaturation.hh
Created January 6, 2018 09:41
Clamp with desaturation (partial code)
// RGB to YUV conversion matrix
#define LUMA_COEFFICIENTS 0.29900, 0.58700, 0.11400
#define CHROMA1_COEFFICIENTS -0.14713, -0.28886, 0.43600
#define CHROMA2_COEFFICIENTS 0.61500, -0.51499, -0.10001
// YUV to RGB conversion matrix
#define R_YUV_COEFFICIENTS 1, 0.00000, 1.13983
#define G_YUV_COEFFICIENTS 1, -0.39465, -0.58060
#define B_YUV_COEFFICIENTS 1, 2.03211, 0.00000
template<typename VecType>