Skip to content

Instantly share code, notes, and snippets.

Avatar

Benjamin Rosseaux BeRo1985

View GitHub Profile
@BeRo1985
BeRo1985 / ForceDedicatedGPUUsageForOpenGL.pas
Created May 30, 2018 04:04
Force usage of dedicated GPU for OpenGL with Delphi and FreePascal/Lazarus on Multi-GPU systems such as Notebooks on Windows
View ForceDedicatedGPUUsageForOpenGL.pas
// Force usage of dedicated GPU for OpenGL with Delphi and FreePascal/Lazarus on Multi-GPU systems such as Notebooks on Windows
// Insert that into your main source file, which is for example the .dpr (Delphi) or .lpr (Lazarus) file
{$define ForceDedicatedGPUUsage} // then you can uncomment and recomment this line, for compile-time-switching between
// integrated GPU and dedicated GPU
{$if defined(Windows) and defined(ForceDedicatedGPUUsage) and (defined(cpu386) or defined(cpux64) or defined(cpuamd64))}
{$ifdef fpc}
{$asmmode intel}
{$endif}
@BeRo1985
BeRo1985 / gist:c1373a49b8ed19499d8bc07eda95a382
Created April 30, 2018 05:26 — forked from lordkhonsu/gist:7eca5cbf0440589946c7
bash sed anonymize ip adresses in file
View gist:c1373a49b8ed19499d8bc07eda95a382

This line will replace the last octet of ipv4 adresses in a given file with a zero:

sed -i '' -e 's/(([0-9]{1,3}.){3})[0-9]{1,3}/\10/g'

@BeRo1985
BeRo1985 / en_DE
Created March 25, 2018 14:52
/usr/share/i18n/locales/en_DE
View en_DE
comment_char %
escape_char /
% Locale for English locale in Germany
LC_IDENTIFICATION
title "English locale for Germany"
source ""
address ""
contact "Benjamin Rosseaux"
email "benjamin@rosseaux.de"
@BeRo1985
BeRo1985 / spirv_variable_extractor.pas
Created February 28, 2018 17:31
spirv_variable_extractor.pas
View spirv_variable_extractor.pas
function TpvVulkanShaderModule.GetVariables:TpvVulkanShaderModuleVariables;
// https://www.khronos.org/registry/spir-v/specs/1.1/SPIRV.html
type PUInt32Array=^TUInt32Array;
TUInt32Array=array[0..65535] of TpvUInt32;
var Position,Size:TpvInt32;
Opcode,Index,NameIndex,Count,CountIDs,CountNames:TpvUInt32;
Opcodes:PUInt32Array;
Endian:boolean;
Variable:PpvVulkanShaderModuleVariable;
Bindings,Locations,DescriptorSets:array of TpvUInt32;
@BeRo1985
BeRo1985 / proceduralhumanoidskeleton.glsl
Created February 6, 2018 01:01
Procedural humanoid skeleton structure
View proceduralhumanoidskeleton.glsl
// ----------
// | |
// | |
// | |
// | |
// | |
// ---HEAD---
// | |
// _______________________________/--NECK--\______________________________
@BeRo1985
BeRo1985 / minifycss.pas
Created December 23, 2017 12:28
ObjectPascal simple but fast and efficient CSS minifier
View minifycss.pas
function MinifyCSS(const aInput:ansistring):ansistring;
var Position,Len,TemporaryPosition:longint;
TemporaryInput:string;
begin
Position:=1;
Len:=length(aInput);
TemporaryInput:='';
while Position<=Len do begin
if ((Position+2)<=Len) and ((aInput[Position]='/') and (aInput[Position+1]='*')) then begin
inc(Position,2);
@BeRo1985
BeRo1985 / qtangent_quaternion.glsl
Last active October 18, 2017 10:14
GLSL QTangent and Quaternion code stuff
View qtangent_quaternion.glsl
// Copyright (C) 2017, Benjamin 'BeRo' Rosseaux - benjamin@rosseaux.de
// License: CC0
vec4 matrixToQTangent(mat3 m){
float f = 1.0;
if(((((((m[0][0]*m[1][1]*m[2][2])+
(m[0][1]*m[1][2]*m[2][0])
)+
(m[0][2]*m[1][0]*m[2][1])
)-
@BeRo1985
BeRo1985 / fragment.glsl
Last active December 22, 2016 14:55
Intel GLSL function-inlining compiler bug testcase
View fragment.glsl
///////// Fragment shader: //////////
#version 430
in vec2 vTexCoord;
uniform vec2 resolution; // the canvas resolution size
layout(location = 0) out vec4 oColor;
#if 1
float opUnion(const in float d1, const in float d2){
@BeRo1985
BeRo1985 / keybase.md
Created July 5, 2016 14:08
keybase.md
View keybase.md

Keybase proof

I hereby claim:

  • I am BeRo1985 on github.
  • I am bero (https://keybase.io/bero) on keybase.
  • I have a public key whose fingerprint is 82D7 1927 94C1 94CB F680 8627 DDA2 6B2E 4E80 9446

To claim this, I am signing this object:

@BeRo1985
BeRo1985 / _results.txt
Last active June 12, 2016 16:26
POCA vs Lua benchmark
View _results.txt
d:\Projects\POCA\trunk\src>lua53.exe primes.lua
time: 0.18200000 seconds, primes: 17984.000000
time: 54.92000000 seconds, primes: 17984.000000
time: 50.26400000 seconds, primes: 17984.000000
d:\Projects\POCA\trunk\src>pocarun primes.poca
time: 0.032 seconds, primes: 17984
time: 14.741 seconds, primes: 17984
time: 13.948 seconds, primes: 17984