Skip to content

Instantly share code, notes, and snippets.

View stonstad's full-sized avatar

Shaun Tonstad stonstad

View GitHub Profile
@stonstad
stonstad / BenchmarkCustomColumn.cs
Last active April 22, 2024 15:03
BenchmarkDotNet Metadata Column
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
using System.Linq;
namespace Example.Benchmarking
{
public class BenchmarkCustomColumn : IColumn
{
public string Id => nameof(BenchmarkCustomColumn);
@stonstad
stonstad / GPTClient.cs
Last active September 14, 2023 13:58
Simple GPT-3.5-Turbo C# Client
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace GPTClient
{
class Program
{
static async Task Main(string[] args)
using System.Collections.Generic;
using System.IO;
using Unity.Collections;
using UnityEngine;
using UnityEngine.Rendering;
namespace Sample
{
public struct Buffer
{
@stonstad
stonstad / ReflectionProbeMaterial.Shader
Last active November 15, 2021 19:39
ReflectionProbeMaterial.Shader
Shader "Example/ReflectionProbeMaterial"
{
Properties
{
_Blend0("CubeMap 1 Blend", Range(0.0, 1.0)) = 0.5
_Blend1("CubeMap 2 Blend", Range(0.0, 1.0)) = 0.5
_Scalar0("CubeMap 1 Scalar", Range(0.0, 20.0)) = 1.0
_Scalar1("CubeMap 2 Scalar", Range(0.0, 20.0)) = 1.0
_Alpha("Alpha", Range(0.0, 1.0)) = 1.0
[NoScaleOffset] _AlbedoMap("Albedo Map", 2D) = "black" {}
// Derived from Unity built-in shader source.
// https://raw.githubusercontent.com/chsxf/unity-built-in-shaders/0c7940740e75340009bbed453e2b198e294e4bab/Shaders/DefaultResourcesExtra/Skybox-Panoramic.shader
Shader "Skybox/Dual Panoramic" {
Properties{
_Tint1("Tint Color 1", Color) = (.5, .5, .5, .5)
_Tint2("Tint Color 2", Color) = (.5, .5, .5, .5)
[Gamma] _Exposure1("Exposure 1", Range(0, 8)) = 1.0
[Gamma] _Exposure2("Exposure 2", Range(0, 8)) = 1.0
_Rotation1("Rotation1", Range(0, 360)) = 0
@stonstad
stonstad / UnityUtils.cs
Created September 22, 2020 17:15
Locate Unity Assets Which Contain Broken References
using System;
using System.IO;
using UnityEditor;
using UnityEngine;
using System.Linq;
using System.Threading.Tasks;
public class UnityUtils: MonoBehaviour
{
[MenuItem("Tools/Find Broken GUIDs")]
@stonstad
stonstad / AnimatorExtensions.cs
Last active November 6, 2022 17:52
Unity Animation State Start and Stop Notifications
using System;
using System.Reflection;
using UnityEngine;
public static class AnimatorExtensions
{
/// <summary>Gets an instance method with single argument of type <typeparamref
/// name="TArg0"/> and return type of <typeparamref name="TReturn"/> from <typeparamref
/// name="TThis"/> and compiles it into a fast open delegate.</summary>
/// <typeparam name="TThis">Type of the class owning the instance method.</typeparam>