Skip to content

Instantly share code, notes, and snippets.

Kris Kowal kriskowal

Block or report user

Report or block kriskowal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kriskowal
kriskowal / runes.go
Created Feb 2, 2019
Generate tables for converting an image describing line art into the corresponding runes.
View runes.go
package main
var lineArtRuneOffsets = []uint8{
// Index NnSsEeWs NnSsEeWw Rune
0x00, // 00000000 -------- " "
0x01, // 00000001 -------w "╴"
0x01, // 00000010 -------w "╴"
0x10, // 00000011 ------W- "╸"
0x02, // 00000100 -----e-- "╶"
0x03, // 00000101 -----e-w "─"
View peruacru.js
// @generated
/*eslint semi:[0], no-native-reassign:[0]*/
global = this;
(function (modules) {
// Bundle allows the run-time to extract already-loaded modules from the
// boot bundle.
var bundle = {};
var main;
@kriskowal
kriskowal / kni-markdown-style.md
Last active Dec 12, 2018 — forked from snowyu/kni-markdown-style.md
The new style markdown KNI
View kni-markdown-style.md

Starting with @snowyu’s proposal I infer some design principles:

  1. This language is designed to be easy to render using existing Markdown, YAML, and syntax highlighters.
  2. The language should break out to TypeScript that is evaluated in the scope of a global object that represents all of the play state.
  3. The Markdown script is a Markdown subset that uses inline backtick expressions to break out to an annotation language that carry semantics.
  4. The annotation language embeds the TypeScript grammar for evaluating expressions.

My iteration on this design adds some detail:

  1. We use a Markdown variant that forbids arbitrary HTML, adds semantics to list item notation, and uses backticks for annotations.
@kriskowal
kriskowal / archery.knit
Last active Dec 12, 2018
I wonder whether I could make this language work.
View archery.knit
- TYPE ITEMTYPE:
- A: THREAD
- ONE: THREAD
- MANY: THREAD
- TYPE ITEM:
- TYPE: ITEMTYPE
- COUNT: NUMBER
- ITEMTYPE ARROWTYPE:
- A: an
View 0-usage.js
idle.then(series([
delay(1000),
() => console.log('A'),
parallel([
series([delay(333), () => console.log('1/3')]),
series([delay(666), () => console.log('2/3')]),
series([delay(999), () => console.log('3/3')]),
]),
delay(1000),
() => console.log('B'),
View shortest-paths.bash
#!/bin/bash
jq -Rr 'split(",")' | jq -scr '
def table_to_edges: . as [$src, $dst, $weight] |
{$src, $dst, weight: $weight | tonumber};
def edges_to_table: . as {$src, $dst, $weight} |
[$src, $dst, $weight];
def graph_to_edges:
View shortest-paths.bash
#!/bin/bash
jq -Rr 'split(",")' | jq -scr '
def table_to_edges: . as [$src, $dst, $weight] |
{$src, $dst, weight: $weight | tonumber};
def edges_to_table: . as {$src, $dst, $weight} |
[$src, $dst, $weight];
def graph_to_edges:
@kriskowal
kriskowal / Authors of GG CLA.md
Last active Oct 4, 2018 — forked from CLAassistant/SAP_CLA
Authors of GG Contributor License Agreement
View Authors of GG CLA.md

Authors of GG Individual Contributor License Agreement

Thank you for your interest in contributing to open source software projects (“Projects”) made available by Authors of GG (“Authors”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to Authors in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please

@kriskowal
kriskowal / controltheoryplayground.go
Last active Sep 19, 2018
A control theory playground. Eliminate dropped messages, minimize latency, maximize throughput.
View controltheoryplayground.go
package main
import (
"fmt"
"image"
"image/color"
"image/draw"
"image/png"
"os"
"sync"
View projection.js
var origin = entities[0].position;
for (var i = 0; i < entities.length; i++) {
var entity = entities[i];
entity.relativePosition.copyFrom(entity.position).subThis(origin);
entity.distance = entity.relativePosition.distance();
entity.direction = Math.atan2(entity.relativePosition.y, entity.relativePosition.x);
entity.distortion = res*Math.atan2(entity.distance, elevation)/Math.PI;
entity.projection.x = Math.cos(entity.direction) * entity.distortion;
entity.projection.y = Math.sin(entity.direction) * entity.distortion;
drawVessel(entity.projection.x, entity.projection.y, entity.orientation);
You can’t perform that action at this time.