Skip to content

Instantly share code, notes, and snippets.

View erichocean's full-sized avatar

Erich Ocean erichocean

  • Xy Group Ltd
  • North Carolina
View GitHub Profile
@totallyRonja
totallyRonja / oklab.hlslinc
Created March 24, 2021 13:47
OkLab color conversion functions for hlsl
static const float3x3 lrgb2cone = {
0.412165612, 0.211859107, 0.0883097947,
0.536275208, 0.6807189584, 0.2818474174,
0.0514575653, 0.107406579, 0.6302613616,
};
static const float3x3 cone2lab = {
+0.2104542553, +1.9779984951, +0.0259040371,
+0.7936177850, -2.4285922050, +0.7827717662,
+0.0040720468, +0.4505937099, -0.8086757660,
// Length-segregated string tables for length < 16. You use a separate overflow table for length >= 16.
// By segregating like this you can pack the string data in the table itself tightly without any padding. The datapath
// is uniform and efficient for all lengths < 16 by using unaligned 16-byte SIMD loads/compares and masking off the length prefix.
// One of the benefits of packing string data tightly for each length table is that you can afford to reduce the load factor
// on shorter length tables without hurting space utilization too much. This can push hole-in-one rates into the 95% range without
// too much of a negative impact on cache utilization.
// Since get() takes a vector register as an argument with the key, you want to shape the upstream code so the string to be queried
// is naturally in a vector. For example, in an optimized identifier lexer you should already have a SIMD fast path for length < 16
@dondragmer
dondragmer / PrefixSort.compute
Created January 20, 2021 23:32
An optimized GPU counting sort
#pragma use_dxc //enable SM 6.0 features, in Unity this is only supported on version 2020.2.0a8 or later with D3D12 enabled
#pragma kernel CountTotalsInBlock
#pragma kernel BlockCountPostfixSum
#pragma kernel CalculateOffsetsForEachKey
#pragma kernel FinalSort
uint _FirstBitToSort;
int _NumElements;
int _NumBlocks;
bool _ShouldSortPayload;
Shader "Hidden/JumpFloodOutline"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "PreviewType" = "Plane" }
Cull Off ZWrite Off ZTest Always
@Opioid
Opioid / aces.py
Last active August 13, 2025 16:51
sRGB to ACEScg
import numpy as np
# Formula from: http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
def rgb_to_xyz(r, g, b, w):
xyz_r = np.array([r[0] / r[1], 1, (1 - r[0] - r[1]) / r[1]])
xyz_g = np.array([g[0] / g[1], 1, (1 - g[0] - g[1]) / g[1]])
xyz_b = np.array([b[0] / b[1], 1, (1 - b[0] - b[1]) / b[1]])
xyz_w = np.array([w[0] / w[1], 1, (1 - w[0] - w[1]) / w[1]])
s = xyz_w * np.linalg.inv(np.matrix([xyz_r, xyz_g, xyz_b]))
@howiemnet
howiemnet / Houdini-->Fusion animation exporter thingy.py
Last active January 14, 2024 20:48
Early version of Houdini to Fusion animation exporter
################################################################
#
# h's hacky Houdini --> Fusion camera animation exporter
#
# Last mod: 20/3/2020 / [email protected]
#
#
#
#
# Notes:
@IanColdwater
IanColdwater / twittermute.txt
Last active December 6, 2025 11:37
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@ranjanprj
ranjanprj / PG_EXTN_C_WITH_RUST.md
Last active November 9, 2019 18:10
PostgreSQL Extension in C with Rustlang

Just a small gist to show how you can easily create a Rust shared lib, wrap it with C and call it from PostgreSQL SQL Command.

  1. Prereq : Tested on Ubuntu 18, GCC, postgresql-server-11, postgresql-dev-11, rustlang
  2. Create new project Cargo embed and cd embed
  3. Rename the file src/main.rs to lib.rs
  4. Add following code
#[no_mangle]
pub extern fn double_input(input: i32) -> i32 {
    input * 2

Results of Skia's nanobench for each of available configs.

The RPi4 board was using default clocks and was provided adequate power and cooling. The tests were conducted on fully-updated Raspbian Buster.

Skia was built with https://github.com/google/skia/commit/1e03b6b10e89fc54f379df4b2d705b1c64e2e0d6

I'd love to test with RPi3B and RPi3B+ that I have, but my charger and PSU seem to be too weak, as both boards report "under voltage" condition.

@frenchy64
frenchy64 / README.md
Last active July 27, 2025 16:50
RFC: Animation for cljfx

RFC: Animation for cljfx

This is an initial attempt at supporting animations in cljfx. Running instructions are below.

The actual animation logic is here under the Demo comment.

The original code is here.

Running