Skip to content

Instantly share code, notes, and snippets.

View dbuck's full-sized avatar

Dave Buchhofer dbuck

View GitHub Profile
@dbuck
dbuck / fast_mlx.md
Created May 20, 2026 23:42 — forked from awni/fast_mlx.md
Writing Fast MLX

Making MLX Go Fast

This guide assumes you have some familiarity with MLX and want to make your MLX model or algorithm as efficient as possible.

The guide covers the following:

@dbuck
dbuck / machine.js
Last active November 16, 2020 16:22
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@dbuck
dbuck / oculus-scale-factors.txt
Created June 16, 2020 19:14
XRSession.getNativeFramebufferScaleFactor()
https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/getNativeFramebufferScaleFactor
window size reports as 800 x 452, flatmode, mid width on both devices.
GO - Qualcomm 530 chip
framebuffer size:
- default: 2048 x 1024
- max: 2867 x 1433
- native multiplier: 1.399999976158142
@dbuck
dbuck / machine.js
Last active October 30, 2019 14:07
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@dbuck
dbuck / machine.js
Last active October 30, 2019 13:44
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@dbuck
dbuck / RuntimeAtlasUpdate
Last active May 3, 2020 04:04
runtime creating a series of ngui atlases from an array of textures - unity3d
private class TextureDownloader
{
public WWW www;
public string url;
public Texture2D tex;
public string atlasName;
}
IEnumerator _UpdateAtlas(List<TextureDownloader> texIndex)
{
@dbuck
dbuck / WaitForDownloads
Last active December 22, 2015 16:29
Unity3d - wait for a list of WWW's to finish downloading, checking in intervals and reporting progress to console for large files.
IEnumerator _WaitForAllDownloadsToFinish(List<WWW> wwws, float checkInterval = 1f, string helperName = "")
{
yield return new WaitForEndOfFrame(); //start checking next frame, to let the downloads start
while (true)
{
var done = true;
foreach (var r in wwws)
{
done = done & r.isDone;
if (r.error != null)
@dbuck
dbuck / gist:6009100
Created July 16, 2013 14:15
Editor code snip to replace the CreateEmpty gameobject function with one that will always show up as the child of the currently selected game object.
[MenuItem("GameObject/Create Empty %#n", priority = -1)]
static void menu_GameObject_CreateEmpty()
{
//Debug.Log("menu_GameObject_CreateEmpty");
Undo.RegisterSceneUndo("Create Empty");
GameObject go = new GameObject("GameObject");
go.transform.parent = Selection.activeTransform;
go.transform.localPosition = Vector3.zero;
go.transform.localRotation = Quaternion.identity;
go.transform.localScale = Vector3.one;
UILabel exampleLabel;
Vector3 textSize;
textSize = exampleLabel.font.CalculatePrintedSize(exampleLabel.text, false, UIFont.SymbolStyle.None)*exampleLabel.font.size;
@dbuck
dbuck / Hydra.cs
Created June 19, 2013 02:35
A series of helper statics for easier interfacing with the Sixense Hydra unity package
using UnityEngine;
using System.Collections;
//a series of helper functions to help work with the hydra closer to how we work with the Input.Mouse* rig.
public class Hydra : MonoBehaviour{
#region Singleton Code
//----------------------------------------------------------------
// Singleton code