This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
from pyhull.delaunay import DelaunayTri | |
import numpy as np | |
import gdal | |
import operator | |
import struct | |
import sys | |
def load(path): | |
print 'load' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSBezierPath+Ops.m | |
// Grids | |
// | |
// Created by Michael Fogleman on 12/2/14. | |
// Copyright (c) 2014 Michael Fogleman. All rights reserved. | |
// | |
#import "NSBezierPath+Ops.h" | |
#import "SkPath.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def load_blocks(path): | |
height = {} | |
with open(path, 'r') as fp: | |
for line in fp: | |
x, y, z = map(int, line.strip().split('|')) | |
height[(x, z)] = max(y, height.get((x, z), 0)) | |
return height | |
def main(): | |
height = load_blocks('blocks.txt') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from builder import * | |
from world import * | |
from time import sleep | |
def mountain(x, y, z, w, radius, height, noise): | |
client = get_client() | |
set_block = client.set_block | |
set_blocks = client.set_blocks | |
for dx in range(-radius * 2, radius * 2 + 1): | |
for dz in range(-radius * 2, radius * 2 + 1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pt | |
import ( | |
"math" | |
"math/rand" | |
) | |
type poissonGrid struct { | |
r, size float64 | |
cells map[Vector]Vector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import operator | |
def merge(dicts): | |
result = {} | |
keys = reduce(operator.or_, [set(d) for d in dicts]) | |
for key in keys: | |
values = [d[key] for d in dicts if key in d] | |
result[key] = tuple(reduce(operator.add, x) for x in zip(*values)) | |
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
import sys | |
HEADERS = {'content-type': 'application/json'} | |
class Fabmo(object): | |
def __init__(self, host, port=9876): | |
self.url = 'http://%s:%s' % (host, port) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"github.com/go-gl/gl/v2.1/gl" | |
"github.com/go-gl/glfw/v3.1/glfw" | |
"github.com/ungerik/go-cairo" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module pill() { | |
difference() { | |
hull() { | |
sphere(10, $fn=36); | |
translate([40, 0, 0]) | |
sphere(10, $fn=36); | |
} | |
translate([0, 0, 14]) | |
hull() { | |
sphere(5, $fn=36); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FibonacciIterator(object): | |
def __init__(self): | |
self.data = [0, 1] | |
def next(self): | |
self.data.append(sum(self.data)) | |
return self.data.pop(0) | |
class Fibonacci(object): | |
def __iter__(self): | |
return FibonacciIterator() |