Skip to content

Instantly share code, notes, and snippets.

View MurkyMeow's full-sized avatar
🌺
Types without borders

MurkyMeow

🌺
Types without borders
  • Moscow
  • 01:16 (UTC +03:00)
View GitHub Profile
@akashrajkn
akashrajkn / fifo_writer.js
Last active July 6, 2021 20:50
IPC with pipes (Node.js): Write to pipe, Read processed data from pipe
const fs = require('fs');
const { spawn, fork } = require('child_process');
const path_a = 'pipe_a';
const path_b = 'pipe_b';
let fifo_b = spawn('mkfifo', [path_b]); // Create Pipe B
fifo_b.on('exit', function(status) {
console.log('Created Pipe B');
@unitycoder
unitycoder / if-branchless.shader
Last active April 3, 2024 11:20
Avoiding Branching / Conditionals in Shaders Fast No If
"The common wisdom of "don't use conditionals in shaders" is one of my biggest frustrations with how shaders are taught.
step(y, x) _is_ a conditional! It compiles to identical code as:
float val = (x >= y ? 1.0 : 0.0)
or
float val = 0.0;
if (x >= y) val = 1.0;"
https://twitter.com/bgolus/status/1235254923819802626
// Performing shader divisions without diving *rcp = approximation of 1/x
float myDividedVal = myValToDivide * rcp(myDivider);