Skip to content

Instantly share code, notes, and snippets.

using Fleck;
using System;
using System.Collections.Concurrent;
namespace WebSocketRelay
{
class Program
{
private static string GetConnectionString(IWebSocketConnection socket)
{
@septagon
septagon / index.html
Last active March 6, 2023 15:31
One-file Babylon.js 360 photo viewer
<!DOCTYPE html>
<!-- Assembled from assorted Babylon.js samples -->
<!-- To run from a local folder, do something like the following. -->
<!-- npm install http-server -->
<!-- .\node_modules\.bin\http-server -a localhost -p 8000 -c-1 -->
<!-- then open localhost:8000/index.html (if that's what you named -->
<!-- it) in your browser, with your equirectangular 360 photo -->
<!-- named "image.jpg" in the same directory. -->
<html>
<head>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
/**
* Theory described here: https://en.wikipedia.org/wiki/Levenshtein_distance
* Algorithm described here: https://en.wikipedia.org/wiki/Wagner%E2%80%93Fischer_algorithm
*
* A basic, barely-tested implementation of the Wagner-Fischer algorithm for
RWTexture2D<float3> tex : register(u0);
// Algorithm "xor" from p. 4 of Marsaglia, "Xorshift RNGs", copied in from Wikipedia
uint Xorshift(uint seed)
{
uint x = seed;
x ^= x << 13;
x ^= x >> 17;
x ^= x << 5;
return x;