Skip to content

Instantly share code, notes, and snippets.

View StagPoint's full-sized avatar

StagPoint Software StagPoint

  • StagPoint Software
  • Seattle, WA
View GitHub Profile
@bgolus
bgolus / MobileVRHighlight.shader
Last active February 19, 2025 19:11
A mobile VR and MSAA friendly single object highlight shader using the stencil buffer
Shader "Mobile VR Highlight" {
Properties {
_ColorOutline ("Outline", Color) = (1,1,1,1)
_ColorInterior ("Interior", Color) = (0.25,0.25,0.25,0.25)
_ColorInteriorFaded ("Interior Faded", Color) = (0.1,0.1,0.1,0.1)
_ColorInteriorOcc ("Interior Occluded", Color) = (0.15,0.15,0.15,0.15)
_ColorInteriorOccFaded ("Interior Occluded Faded", Color) = (0.05,0.05,0.05,0.05)
_PulseRateMod ("Pulse Rate Modifier", Float) = 4.0
_OutlneWidth ("Outline Pixel Width", Float) = 1.0
}
@heyomidk
heyomidk / sdDashedCircle.hlsl
Created December 9, 2021 06:24
SDF - Dashed Circle (HLSL), source: https://www.shadertoy.com/view/7tyGWw
float arcRadius = length(p);
// Compute the radial distance field coming out from the center of a torus
const float hw = (RadiusOuter-RadiusInner)*0.5; // half width from center of torus to edge
float radialDF = arcRadius - (RadiusOuter-hw); // creates a torus
radialDF = abs(radialDF)-hw; // give an inside and outside to the torus
// Compute the gradient along the length of the arc
float arcGradient = atan2(p.y,p.x)/6.283185;
arcGradient = frac(arcGradient*NumDashes);
@memononen
memononen / diff.cpp
Last active November 20, 2021 19:01
O(NP) diff with backtracking
#include <stdio.h>
#include <vector>
#include <algorithm>
// Based on "An O(NP) Sequence Comparison Algorithm" by Sun Wu, Udi Manber and Gene Myers
struct Edit {
enum Type { Insert, Delete, Common };
Edit() = default;
Edit(Type _type, int _a, int _b, int _n) : type(_type), a(_a), b(_b), n(_n) {}
@noseratio
noseratio / remove-unwanted-windows11-apps.ps1
Last active January 19, 2025 13:20
Windows 11 autorun resident apps that I have to remove manually
# Teams 2.0 (no work account support yet)
winget uninstall MicrosoftTeams_8wekyb3d8bbwe
# Your Phone
winget uninstall Microsoft.YourPhone_8wekyb3d8bbwe
# Widgets (Web Experience Pack)
winget uninstall MicrosoftWindows.Client.WebExperience_cw5n1h2txyewy
# Cortana
@pervognsen
pervognsen / vs_cpp_setup.md
Last active July 17, 2024 14:27
My Visual Studio setup for C++ development

I recently upgraded to Windows 11 and had to set up Visual Studio C++ again. A few things have changed in Windows 11 with the tiled window management and deeper Windows Terminal integration, so I ended up revisiting my usual VS setup and made a bunch of changes. I'm documenting them here for my own future benefit (yes, I do know about VS import/export settings) and on the off chance that anyone else might get some ideas for their own setup.

It should be mentioned that I'm a single monitor user (multimon gives me neck pain as I've gotten older) and the monitor I currently use is 25". A laptop screen can't really accommodate the 2x2 full screen layout I'm using as my default here, so when I'm on a laptop I only use the vertical layout out of necessity.

@andrew-raphael-lukasik
andrew-raphael-lukasik / .LetsRotateAndSpawn.cs.md
Last active April 11, 2024 22:52
object orientation placement schemes

image0 image1

@andrew-raphael-lukasik
andrew-raphael-lukasik / .LabelAutoFit.cs.md
Last active April 11, 2024 22:52
Custom Label element for Unity / UI Toolkit stack

unity UiToolkit label text auto fit width height this code is NOT production-ready, it's just a sketch to test out a possible solution for a problem

IMPORTANT NOTE: This elemeent doesn't work with flexGrow as it leads to undefined behaviour (recursion). Use Size/Width[%] and Size/Height attributes instead requirement

@NelsonMinar
NelsonMinar / Torena Somnopose Oscar convertor
Last active August 4, 2023 10:40
Torena to Somnopose data convertor for OSCAR
Notes:
https://nelsonslog.wordpress.com/2021/07/21/sleep-position-tracking-and-oscar/
http://www.apneaboard.com/forums/Thread-Torena-sleep-position-monitor-for-Android-similar-to-SomnoPose
@brihernandez
brihernandez / SmoothDamp.cs
Last active April 28, 2025 07:35
Framerate independent damping
using UnityEngine;
// Thanks to Rory Driscoll
// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/
public static class SmoothDamp
{
/// <summary>
/// Creates dampened motion between a and b that is framerate independent.
/// </summary>
/// <param name="from">Initial parameter</param>
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class QuakeLightFlicker : MonoBehaviour
{
public float maxLightIntensity = 2f;
public string flickerString = "mmamammmmammamamaaamammma";
public Light light;