Skip to content

Instantly share code, notes, and snippets.


Nicholas Ewalt Hotrian

View GitHub Profile
View 0_Asynchronous Event

The code given here is an example and not for production usage.

See the blog entry for more information.

View 0_Asynchronous Synchronization without

The code given here is a very simplified example and not for production usage.

The following snippet demonstrates TAP Task Synchronization using SemaphoreSlims in the context of upgrading an existing EAP application which relies on lock statements. This snippet of code doesn't do anything particularly useful, because it isn't supposed to - it is only to demonstrate one way of migrating from the EAP model to the TAP model.

See the blog entry for more information.

View English.xml
<?xml version="1.0" encoding="utf-8"?>
<QuickAccessTitle>OVRdrop Settings Quick Access</QuickAccessTitle>
<QuickAccessAutoSwap>Auto Swap</QuickAccessAutoSwap>
<QuickAccessQuickSwap>Quick Swap</QuickAccessQuickSwap>
<AdvancedSettingsLeftTitle>{b}Target Application Settings{/b}</AdvancedSettingsLeftTitle>
<AdvancedSettingsLeftText2>{b}Window Settings{/b}
Hotrian / Prusa Research Original Prusa i3 MK3.fff
Created February 24, 2018 01:37
[Unmodified] Prusa Research Original Prusa i3 Mk3 FFF (S3D 4.0.1)
View Prusa Research Original Prusa i3 MK3.fff
<?xml version="1.0"?>
<profile name="Prusa Research Original Prusa i3 MK3" version="2018-01-19 08:00:00" app="S3D-Software 4.0.0">
<extruder name="Primary Extruder">
Hotrian / SpriteResizer.cs
Last active July 13, 2018 08:12
Automatically Scales Sprite Texture2Ds, allowing you to multiply the image size safely, and effectively. Not guaranteed to work on every Sprite, or at all for that matter :P.
View SpriteResizer.cs
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
/* Unity Sprite Resizer v1.6 © Hotrian 2017
* This has only been tested on PNG files.
* Usage instructions:
Hotrian / ProtoMesh.cs
Last active March 13, 2022 15:51
Example code for simple Quad and Cube meshes built through code.
View ProtoMesh.cs
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(MeshFilter)), RequireComponent(typeof(MeshRenderer))]
public class ProtoMesh : MonoBehaviour
#region Helper Properties
// Simple helpers to cache the MeshFilter and MeshRenderer
public MeshRenderer MyMeshRenderer
Hotrian / HeadlessScript.cs
Last active September 17, 2020 23:54
Takes a normal Unity Standalone Player Window and hides it off screen and from the Taskbar :). This was made because -batchmode seems to automatically call -nographics now, which breaks things :(.
View HeadlessScript.cs
using System;
using UnityEngine;
using System.Runtime.InteropServices;
public class HeadlessScript : MonoBehaviour
[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
static extern IntPtr FindWindowByCaption(IntPtr zeroOnly, string lpWindowName);
Hotrian / PolygonDrawScript.cs
Last active December 30, 2019 17:39
PolygonCollider2D Mesh Draw Scripts. These 3 scripts allow you to visualize a PolygonCollider2D as a mesh in the Unity game world. Can be used during Edit Mode also to permanently save the Mesh to the scene, but note the Start() method of PolygonDrawScript currently rebuilds the mesh when the game starts anyway. See:…
View PolygonDrawScript.cs
// Note this file goes in Assets/
using UnityEngine;
using System.Collections.Generic;
[RequireComponent(typeof(PolygonCollider2D), typeof(MeshFilter), typeof(MeshRenderer))] // require PolygonCollider2D, MeshFilter, and MeshRenderer
public class PolygonDrawScript : MonoBehaviour
private PolygonCollider2D Poly
Hotrian / SwapVRSettings.bat
Last active June 17, 2016 18:17
I wrote this to quickly enable/disable the OpenVR Leap Motion drivers the lines you need to add to enable the Leap are over here
View SwapVRSettings.bat
@echo off
goto prep
REM This batch script removes the leap drivers temporarily so SteamVR won't attempt to launch them
REM It also backup/restores the SteamVR.vrsettings file so you can have two copies and it switches the correct version in
REM This is just a little batch program I wrote to quickly disable/enable the SteamVR Leap Motion Drivers
REM You should copy steamvr.vrsettings twice and rename one to LeapVRSettings.vrsettings and the other to RegularVRSettings.vrsettings
REM Then run this batch once or twice and then go back in and change your steamvr.vrsettings as needed
Hotrian / ColorMapper.cs
Last active March 16, 2016 16:47
Outputs colored text to System.Console. Colorful code borrowed from See bottom of page for usage.
View ColorMapper.cs
using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace Colorful
/// <summary>
/// Exposes methods used for mapping System.Drawing.Colors to System.ConsoleColors.
/// Based on code that was originally written by Alex Shvedov, and that was then modified by MercuryP.
/// </summary>