Skip to content

Instantly share code, notes, and snippets.

View kriskowal's full-sized avatar

Kris Kowal kriskowal

View GitHub Profile
@kriskowal
kriskowal / inc.sh
Last active March 28, 2020 17:08
shell memo
#!/bin/bash
# Very slow build step.
sleep 5
jq .+1
var DIR = '/tmp/test',
FILE_PATTERN = /test/,
fs = require('q-io/fs');
fs.list(DIR)
.then(function (files) {
var matched = files.filter(function (item) {
return item.match(FILE_PATTERN);
});
if (matched.length !== 1) {
@kriskowal
kriskowal / edlin.lobster
Created February 4, 2020 18:29
Line editor
import std
import color
import vec
let fontsize = 40
let cursor = xy{ 4, fontsize }
let cursor_hz = 2
fatal(gl_window("edlin", 800, 800))

Privacy Policy

Kris Kowal built the Peruacrú app as an open source app. This SERVICE is provided by Kris Kowal at no cost and is intended for use as is.

This page is used to inform visitors regarding our policies with the collection, use, and disclosure of Personal Information if anyone decided to use our Service.

@kriskowal
kriskowal / wanderingents.lobster
Created November 5, 2019 20:08
Wandering Ents Lobster Proof of Concept
import gui
import texture
def scatter(dst, src, stencils):
for(stencils) stencil, i:
for(stencil) j, k:
dst[i][k] = src[j]
def gather_intents(intents, neighborhoods, ents):
for(neighborhoods) neighbors, i:
@kriskowal
kriskowal / runes.go
Created February 2, 2019 22:13
Generate tables for converting an image describing line art into the corresponding runes.
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 "─"
// @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 December 12, 2018 01:54 — forked from snowyu/kni-markdown-style.md
The new style markdown KNI

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 December 12, 2018 01:09
I wonder whether I could make this language work.
- TYPE ITEMTYPE:
- A: THREAD
- ONE: THREAD
- MANY: THREAD
- TYPE ITEM:
- TYPE: ITEMTYPE
- COUNT: NUMBER
- ITEMTYPE ARROWTYPE:
- A: an
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'),