Skip to content

Instantly share code, notes, and snippets.

tangentstorm / BeaconTeleport.cs
Created Dec 5, 2017
BeaconTeleport for unity3d / VRTK
View BeaconTeleport.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using VRTK;
/* This class lets you leave a beacon in the scene and teleport to it later.
* It should be attached to an object that also has a VRTK_ControllerEvents
* component attached.
View magic-squares.k
msq: {[m] s:(-1+m*m) (1 -1 +)\ (_ m%2; 0); 1+/.[m#,m#0; ; :; ]'[(s+2 -1*/:,/m#/:!m)!m; !#s]}
View learntris.c
#include <stdio.h>
#define I(n) for(int i=0; i<n; i++)
#define J(n) for(int j=0; j<n; j++)
#define O(str) printf(str)
#define Oc(c) putc(c, stdout)
#define M(x,y,c) m[y][x]=c;
int main() {
char c; char m[22][10];
tangentstorm / k.bnf
Created Jun 24, 2016
lexer and parser for K language... part of IntelliK
View k.bnf
View keypad_art.c
#include <SoftwareSerial.h>
#include <LedControl.h>
#include <Key.h>
#include <Keypad.h>
const byte rows = 4;
const byte cols = 4;
tangentstorm / gramco.k
Last active Jun 1, 2016
Rough port of my grammar combinator thing to k3.
View gramco.k
/ grammar combinators in K
/ for longer description (in python), see:
/ -- misc helper functions ------------------------------------
join:{[sep;strs] / join strs with 'sep' as delimiter
(#sep) _ ,/ sep,' strs}
>>> ebnf_sc.scan('x = A | b')
[('x', 'IDENT', 0), ('=', '=', 2), ('A', 'IDENT', 4), ('|', '|', 6), ('b', 'IDENT', 8)]
from collections import namedtuple
from warnings import warn
import string
def T(tag, doc, args):
"""Creates a new tuple type."""
def read_ints():
i = 0
while True:
s = input('enter number[%i]:' % i)
yield int(s); i+=1
except ValueError:
if s == "": return
else: print "ignoring invalid number"
tangentstorm / HiRiQ.k
Created Apr 3, 2016
Kona program to render the HiRiQ board.
View HiRiQ.k
a:3 3#0; b:.[a; 1 1;+;1]; c:a+2; d:(c,'a,'c); e:(a,'b,'a); `0:".O "[d,e,d]
usage: t a g s -- machine names
import sys
# get the tags and machine names, each separated by spaces.
# the two groups are separated by --
args = sys.argv[1:]
You can’t perform that action at this time.