Skip to content

Instantly share code, notes, and snippets.

View cnlohr's full-sized avatar

cnlohr cnlohr

View GitHub Profile
@cnlohr
cnlohr / VoronoiTest.shader
Created November 26, 2026 10:02
Voronoi Eggshell Of Image Shader Unity
Shader "Unlit/VoronoiTest"
{
Properties
{
_MainTex ("_MainTex", 2D) = "white" {}
_TANoiseTex ("_TANoiseTex", 2D) = "white" {}
_TANoiseTexNearest ("_TANoiseTexNearest", 2D) = "white" {}
_Fineness("_Fineness", float) = 15.0
_TimeSpeed("_TimeSpeed", float ) = 0.5
_Activeness("_Activeness", float ) = 1.5
@cnlohr
cnlohr / shadow_in_transparency.shader
Created November 23, 2026 08:38
Reading the shadow map in a transparency pass for fun and profit
Shader "Unlit/InvestigateShadowMap"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" "Queue"="Transparent" "LightMode"="ForwardBase" }
@cnlohr
cnlohr / YD-3414-Switch.kicad_mod
Last active July 19, 2026 20:08
YD-3414 Switch
(footprint "YD-3414-Switch"
(version 20260206)
(generator "pcbnew")
(generator_version "10.0")
(layer "F.Cu")
(property "Reference" "REF**"
(at 0 -2.4 0)
(unlocked yes)
(layer "F.SilkS")
(uuid "f4a03561-99b3-4c37-a565-c259d7c734ab")
@cnlohr
cnlohr / inductive_measure.c
Last active May 20, 2026 14:33
Inductance measurement on ch32v003
// Assume setup from touch control
// Connect 20 turns of ~2" wide 28AWG wire between PA2 and GND.
void RunTest()__attribute__((noinline, section(".srodata")));
void DelaySysTick_RAM( uint32_t n ) __attribute__((noinline, section(".srodata")));
void DelaySysTick_RAM( uint32_t n )
{
#if defined(CH32V003) || defined(CH32V00x)
uint32_t targend = SysTick->CNT + n;
@cnlohr
cnlohr / arbitrary_function_tracer.shader
Created March 30, 2026 10:33
Fixed-step object tracer in Unity Shader code
Shader "cnlohr/StepShader"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_TANoiseTex ("TANoise", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
@cnlohr
cnlohr / .vimrc
Last active March 5, 2026 22:26
cnlohr's .vimrc file
set nocompatible
set number
set ruler
syntax on
@cnlohr
cnlohr / quest_geometry_shaders_in_multiview.glsl
Created February 6, 2026 09:50
Example geometry shader running in Unity on Quest.
Shader "Unlit/QuestGEO"
{
Properties
{
}
SubShader
{
Tags { "RenderType"="Opaque" }
Pass
@cnlohr
cnlohr / dependagen.c
Last active November 24, 2025 06:16
Unity .net assembly visualizer
// Execute with
// gcc -g dependagen.c -o dependagen && ./dependagen > test.dot
// dot -Tpng < test.dot > test.png
#include <stdint.h>
#include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <errno.h>
@cnlohr
cnlohr / phasortest.c
Last active October 5, 2025 09:03
Phasor test, power-of-two circles
#include <stdint.h>
#include <stdio.h>
int main()
{
int i;
int a = 0;
int b = 1073741823; // 2^30-1
@cnlohr
cnlohr / testsecret.yml
Created February 5, 2025 04:02
workflow with manual dispatch and secret in environment - needs to be run manually - only works after committed to default branch
# So you don't pull your hair out, workflow dispatches must be in the default branch.
name: Secret Test
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs: