Skip to content

Instantly share code, notes, and snippets.

View mikolalysenko's full-sized avatar

Mikola Lysenko mikolalysenko

View GitHub Profile
@mikolalysenko
mikolalysenko / index.js
Created August 17, 2016 19:00
requirebin sketch
const polytope = require('conway-hart')('tI')
const vec3 = require('gl-vec3')
const HEIGHT = 6
const bounds = require('bound-points')(polytope.positions)
const radius = Math.max(
bounds[1][0] - bounds[0][0],
bounds[1][1] - bounds[0][1],
bounds[1][2] - bounds[0][2])
{
"lowp": [
[
-1.0932616591453552,
-0.6557616889476776
],
[
-0.8432616889476776,
-0.405761674977839
],
var ndarray = require('ndarray')
//Context is a canvas 2d context
var imageData = context.createImageData(WIDTH, HEIGHT)
//Wrap pixels in an ndarray with shape [width x height x 4 (rgba)]
var ndpixels = ndarray(imageData.data, [WIDTH, HEIGHT, 4], [4, 4 * WIDTH, 1], 0)
//Now you can edit pixels as an ndarray!
// ...
@mikolalysenko
mikolalysenko / index.js
Created October 21, 2015 21:12
requirebin sketch
//node.js logo hexagonal cellular automata thing
//
// author: Mikola Lysenko
// (c) 2015 MIT License
//
//Configuration parameters
var ON_STYLE = '#80bd01'
var OFF_STYLE = '#333'
var GRID_DIM = 20
@mikolalysenko
mikolalysenko / MERKLEIZATION.MD
Last active October 8, 2015 19:40
Merkleization - sketchy outline

Merkleization

Introduction

Distributed systems

  • Distributed systems = Computers + relativity
  • Different machines have different clocks, perception of time, and views of the state of the system
  • Challenges: Communication failures, hardware failures, latency, bandwidth
  • All computer systems today are distributed at some level (nature obeys relativity after all), the extent to which this nature is exposed depends on the loads put upon the system.
@mikolalysenko
mikolalysenko / gist:fffe937bce624069d985
Created July 28, 2015 19:16
GLX info for parallels
name of display: :0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: Parallels Inc
server glx version string: 1.4
server glx extensions:
GLX_EXT_texture_from_pixmap, GLX_SGIX_fbconfig
client glx vendor string: Parallels Inc
client glx version string: 1.4
client glx extensions:

Meta algorithms

A list of meta-algorithms

Automatic differentiation

Persistence

Path copying

import plotly.plotly as py
import numpy as np
import random
#Generate 3 random Gaussian clusters with 40 points each
clusters = [40, 40, 40]
x = []
y = []
z = []
for n in clusters:
var boxIntersect = require('box-intersect')
var segIntersect = require('robust-segment-intersect')
function getBoxes(positions, cells) {
return cells.map(function(e) {
var a = positions[e[0]]
var b = positions[e[1]]
return [ Math.min(a[0], b[0]), Math.min(a[1], b[1]), Math.max(a[0], b[0]), Math.max(a[1], b[1]) ]
})
}
var baboon = require("baboon-image")
var ndarray = require('ndarray')
var imshow = require('ndarray-imshow')
var translate = require('ndarray-translate-fft')
var baboon64 = ndarray(new Float64Array(baboon.data), baboon.shape, baboon.stride, 0)
translate.wrap(baboon64, [100, 100, 0])
imshow(baboon64)