Skip to content

Instantly share code, notes, and snippets.

@mnstrspeed
mnstrspeed / export_webgl.py
Created May 2, 2017 23:41
Blender add-on for exporting mesh data as JavaScript arrays for use with WebGL
bl_info = {
"name": "ExportWebGL",
"category": "Object",
}
import bpy
from bpy_extras.io_utils import ExportHelper
from bpy.props import StringProperty, BoolProperty, IntProperty, FloatProperty, EnumProperty
flatten = lambda l: [item for sublist in l for item in sublist]
@mnstrspeed
mnstrspeed / RectangularGainLocomotion.cs
Created April 26, 2017 01:49
Implementation of rectangular gain locomotion (originally described in this talk at Vision Summit 2016: https://www.youtube.com/watch?v=At_Zac4Xezw)
using UnityEngine;
public class RectangularGainLocomotion : MonoBehaviour
{
public Transform Head;
public float Gain = 1f;
public Vector2 NeutralAreaSize = Vector2.one;
[Header("Visual helpers")]
public Transform NeutralAreaPreview;
@mnstrspeed
mnstrspeed / SimpleGainLocomotion.cs
Created April 26, 2017 01:47
Implementation of simple gain locomotion (originally described in this talk at Vision Summit 2016: https://www.youtube.com/watch?v=At_Zac4Xezw)
using UnityEngine;
public class SimpleGainLocomotion : MonoBehaviour
{
public Transform Head;
public float Gain = 1f;
void Update()
{
Vector3 localPlayerPosition = this.transform.InverseTransformPoint(this.Head.position);
@mnstrspeed
mnstrspeed / MotionCapture.cs
Last active October 14, 2016 21:12
Motion capture recording and playback for SteamVR in Unity
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MotionCapture : MonoBehaviour
{
public SteamVR_TrackedObject Hmd;
public SteamVR_TrackedController Left;
@mnstrspeed
mnstrspeed / keybase.md
Created September 22, 2016 17:34
keybase.md

Keybase proof

I hereby claim:

  • I am mnstrspeed on github.
  • I am tsndrs (https://keybase.io/tsndrs) on keybase.
  • I have a public key ASAOAHR4FIqawCuZjBD2i7Bv1hCvpgQX7MtB6K8JVXG4BQo

To claim this, I am signing this object:

@mnstrspeed
mnstrspeed / collegerama.sh
Created December 7, 2015 16:27
Download video lectures from TU Delft Collegerama (december 2015). Requires `wget`, `curl`, and `jq` (available in Ubuntu/Debian repositories).
#!/bin/bash
# resource ID of the video, can be obtained from the video URL:
# https://collegerama.tudelft.nl/Mediasite/Play/485dbc9fac81446bae6b2ba2fe0571ac1d?catalog=cf028e9a-2a24-4e1f-bdb5-2ace3f9cd42d
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
id=$1
SERVICE_ENDPOINT="https://collegerama.tudelft.nl/Mediasite/PlayerService/PlayerService.svc/json/GetPlayerOptions"
params="{\"getPlayerOptionsRequest\":{\"ResourceId\":\"${id}\",\"QueryString\":\"?catalog=cf028e9a-2a24-4e1f-bdb5-2ace3f9cd42d\",\"UseScreenReader\":false,\"UrlReferrer\":\"\"}}"
@mnstrspeed
mnstrspeed / install.sh
Last active August 29, 2015 14:16
events
mkdir /etc/event
curl -s https://gist.githubusercontent.com/mnstrspeed/e032c26f7fbd4f36c687/raw/b4c9977f5522e32a810b6e1d5514cdfef46f158c/trigger > /etc/event/trigger
chmod +x /etc/event/trigger
ln -s /etc/event/trigger /usr/bin/trigger
@mnstrspeed
mnstrspeed / shitstorm.sh
Last active August 29, 2015 14:15
[FP] Keeps throwing ungraded work at you until you beg for mercy
#! /bin/bash
# shitstorm.sh keeps throwing ungraded work at
# you until you beg for mercy
EDITOR="vi -p"
for fulldir in "${1:+$1/}"[sez][0-9]*; do
dir="${fulldir##*/}"
file="${fulldir}/${dir}.txt"
@mnstrspeed
mnstrspeed / Commentaar voor inline.py.html
Last active August 29, 2015 14:14
Fancy inline comments
<html>
<head>
<style type="text/css">
ol {
color: #eee;
font-family: monospace;
}
pre {
margin: 0;
}
@mnstrspeed
mnstrspeed / gist:81e2547f4d09ec67a05d
Last active August 29, 2015 14:12
CamelCase-enizer
public class CamelCase {
public static void main(String[] args) {
String line = "if at lake and lake has not been probed, blink lights, probe lake, steer away from obstacles";
System.out.println(toCamelCase(line) + "Rule");
// IfAtLakeAndLakeHasNotBeenProbedThenBlinkLightsThenProbeLakeThenSteerAwayFromObstaclesRule
}
private static String toCamelCase(String line) {
StringBuilder builder = new StringBuilder();