Skip to content

Instantly share code, notes, and snippets.

@camnewnham
camnewnham / UltraleapPostProcessor.cs
Created April 23, 2024 02:54
Disable and re-enable ultraleap for Unity builds
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEngine;
namespace MyApp
{
/// <summary>
/// Disables the Ultraleap provider at build time
/// </summary>
public class UltraleapPreprocessor : IPreprocessBuildWithReport
@camnewnham
camnewnham / DesktopLeapXRServiceProvider.cs
Last active April 2, 2024 06:40
Configures leap motion to work in the editor
using Leap.Unity;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
/// <summary>
/// Allows using the Ultraleap in Desktop Mode for editor debugging, rather than on a headset.
/// Local position and rotation control the offset of the device.
@camnewnham
camnewnham / download.ps1
Last active February 23, 2024 08:16
Youtube Music Playlist Download
# get yt-dlp (https://github.com/yt-dlp/yt-dlp)
# install ffmpeg (choco install ffmpeg or https://www.ffmpeg.org/download.html
# run command below
# copy to the "Music" folder on your Garmin Watch via USB
# example $URL = "https://music.youtube.com/playlist?list=PL-BHPGwxCFX_onAQe_WIv7JewuMpT38Ft"
$URL = Read-Host "Enter YouTube Music Playlist URL"
.\yt-dlp --output "%(playlist_id)s/%(id)s.%(ext)s" --add-metadata --extract-audio --audio-format mp3 --write-playlist-metafiles --write-info-json "$URL"
$URL -match "(?<=list=)[^&]+"
$PLAYLIST_ID = $Matches[0]
@camnewnham
camnewnham / Mesher.cs
Created February 8, 2024 23:27
Join Groups Into Meshes
using System;
using Rhino;
using Rhino.DocObjects;
using Rhino.Geometry;
using System.Collections.Generic;
Dictionary<int, List<RhinoObject>> map = new Dictionary<int, List<RhinoObject>>();
MeshingParameters meshingParameters = MeshingParameters.Minimal;
meshingParameters.SimplePlanes = true;
@camnewnham
camnewnham / YakAPI.cs
Last active February 2, 2024 00:59
JSON classes for Rhino Package Manager (Yak) API
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
namespace CN
{
public static class YakApi
{
private static HttpClient httpClient = new HttpClient();
@camnewnham
camnewnham / iOSPostProcessor.cs
Last active October 17, 2023 02:59
Run Unity iOS app behind control center
// Belongs in an Assets/**/Editor folder
public class iOSPostProcessor
{
/// <summary>
/// Post processor to automate skipping the checkbox on testflight for encryption compliance.
/// </summary>
[PostProcessBuild(-999)]
public static void OnPostProcessBuildRunInBackground(BuildTarget buildTarget, string path)
{
@camnewnham
camnewnham / VertexBillboard.shader
Created June 2, 2022 00:11
Point cloud shaders
Shader "Points/Billboard"
{
Properties
{
_PointSize("PointSize", Range(0, 0.1)) = 0.01
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend("Source Blend", Float) = 1 // "One"
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend("Destination Blend", Float) = 0 // "Zero"
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("Depth Test", Float) = 4 // "LessEqual"
[Enum(DepthWrite)] _ZWrite("Depth Write", Float) = 1 // "On"
}
@camnewnham
camnewnham / log.txt
Created February 14, 2022 06:16
Unable to load DLL 'avapi32.dll' UWP ARM64 with Sipsorcery
Autoconnected Player [Error] System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: Error resolving name servers ---> System.DllNotFoundException: Unable to load DLL 'advapi32.dll': The specified module could not be found.
at Microsoft.Win32.Win32RegistryApi.OpenSubKey (Microsoft.Win32.RegistryKey rkey, System.String keyName, System.Boolean writable) [0x00000] in <00000000000000000000000000000000>:0
at Microsoft.Win32.RegistryKey.OpenSubKey (System.String name, System.Boolean writable) [0x00000] in <00000000000000000000000000000000>:0
at Microsoft.Win32.RegistryKey.OpenSubKey (System.String name) [0x00000] in <00000000000000000000000000000000>:0
at DnsClient.Windows.NameResolutionPolicy.Resolve (System.Boolean includeGenericServers, System.Boolean includeDirectAccessServers) [0x00000] in <00000000000000000000000000000000>:0
at DnsClient.NameServer.ResolveNameResolutionPolicyServers () [0x00000] in <00000000000000000000000000000000>:0
at DnsClient.NameSe
@camnewnham
camnewnham / MyTestComponent2
Created February 6, 2020 23:42
Using ExpireSolution instead of ScheduleSolution
using Grasshopper.Kernel;
using System;
namespace MyTestComponent
{
public class TestComponent : GH_Component
{
public override Guid ComponentGuid => new Guid("{86A4E46A-520B-4C6B-8AD2-9939097778E5}");
public TestComponent() : base(
using Grasshopper.Kernel;
using System;
namespace MyTestComponent
{
public class TestComponent : GH_Component
{
public override Guid ComponentGuid => new Guid("{86A4E46A-520B-4C6B-8AD2-9939097778E5}");
public TestComponent() : base(