Skip to content

Instantly share code, notes, and snippets.

View mikolalysenko's full-sized avatar

Mikola Lysenko mikolalysenko

View GitHub Profile
var ops = require('ndarray-ops')
function toRGBA (glyph) {
var output = ndarray(
new Uint8ClampedArray(glyph.size*4),
[glyph.shape[0], glyph.shape[1], 4])
for(var i=0; i<3; ++i) {
ops.assign(output.pick(-1,-1,i), glyph)
}
ops.assigns(output.pick(-1,-1,3), 0xff)
var ops = require('ndarray-ops')
function toRGBA (glyph) {
var output = ndarray(
new Uint8ClampedArray(glyph.size*4),
[glyph.shape[0], glyph.shape[1], 4])
var glyphPad = ndarray(
glyph.data,
//Sets all components equal, works in place
function toRGBA (glyph) {
return ndarray(
glyph.data,
[glyph.shape[0], glyph.shape[1], 4],
[glyph.stride[0], glyph.stride[1], 0],
glyph.offset)
}
'use strict'
var gauss = require('gauss-random')
var uniq = require('uniq')
var alphaShape = require('alpha-shape')
var graphToPolygons = require('planar-graph-to-polyline')
var delaunay = require('delaunay-triangulate')
var circumradius = require('circumradius')
function coalphaComplex(alpha, points) {
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)
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]) ]
})
}
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:

Meta algorithms

A list of meta-algorithms

Automatic differentiation

Persistence

Path copying

@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:
@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.