Skip to content

Instantly share code, notes, and snippets.

View fogleman's full-sized avatar

Michael Fogleman fogleman

View GitHub Profile
@fogleman
fogleman / makeblock-xy-plotter.md
Last active February 24, 2016 18:05
Getting Started with the Makeblock XY Plotter 2.0

Assembly is straightforward but takes a while. Comes with all the tools you need. Everything is metric. I recommend labeling the screw packets before starting so you know which size is which.

I ended up tightening the drive belts after initial assembly, which is tough to do. I used vise grips to help.

I also added a couple washers (of my own) to the pen mechanism to reduce slop. On either side of the arm that raises / lowers the pen.

There are two software packages, one is Windows only (Benbox) and the other is cross-platform (mDraw). I've only used mDraw. Each ships with its own firmware I think.

Their software is crappy but good enough as a starting point. It's easy to roll your own software in any language that can connect to the serial port. Baud rate is 115200.

@fogleman
fogleman / dla.go
Created February 2, 2016 03:42
Diffusion Limited Aggregation
package main
import (
"fmt"
"math"
"math/rand"
"github.com/ungerik/go-cairo"
)
@fogleman
fogleman / dla2.go
Created February 2, 2016 20:23
Diffusion-Limited Aggregation
package main
import (
"fmt"
"image"
"image/color"
"image/png"
"math/rand"
"os"
)
@fogleman
fogleman / draw.go
Created February 17, 2016 22:32
Drawing in Go?
package main
import (
"image"
"image/draw"
"image/png"
"os"
"github.com/golang/freetype/raster"
"golang.org/x/image/math/fixed"
@fogleman
fogleman / text.go
Created February 24, 2016 02:56
Meme-style Text
package main
import "github.com/fogleman/gg"
func main() {
const S = 1024
dc := gg.NewContext(S, S)
dc.SetRGB(1, 1, 1)
dc.Clear()
dc.LoadFontFace("/Library/Fonts/Impact.ttf", 96)
@fogleman
fogleman / permutations.py
Created March 19, 2016 22:02
Permutations of Rides & Vehicles
import itertools
import math
# https://www.wolframalpha.com/input/?i=1,6,90,2520,113400
# a(n) = (2n)! / 2^n
# https://oeis.org/A000680
def f(n):
return math.factorial(2 * n) / (2 ** n)
def brute():
@fogleman
fogleman / sgf.py
Created March 21, 2016 01:46
SGF Parser & Board State for Go / Baduk
import sys
class Board(object):
def __init__(self, size):
self.size = size
self.grid = {}
def move(self, color, x, y):
self.set(color, x, y)
for dx, dy in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
nx = x + dx
@fogleman
fogleman / terrain.go
Created May 5, 2016 17:34
terrain.go
package main
import (
"image"
"image/png"
"net/http"
. "github.com/fogleman/pt/pt"
)
@fogleman
fogleman / elevation.py
Created May 5, 2016 22:07
elevation.py
import pg
class Window(pg.Window):
def setup(self):
self.set_clear_color(0.87, 0.81, 0.70)
self.wasd = pg.WASD(self, speed=0.3)
self.wasd.look_at((0, 0, 0), (30, -5, 30))
self.context = pg.Context(pg.DirectionalLightProgram())
self.context.specular_multiplier = 0.25
self.context.ambient_color = (0.5, 0.5, 0.5)
@fogleman
fogleman / wiggle.py
Created May 24, 2016 13:47
Wigglegrams
from PIL import Image, ImageChops, ImageDraw
import os
def load_images(folder):
result = []
for name in os.listdir(folder):
path = os.path.join(folder, name)
print path
im = Image.open(path)
result.append(im)