Skip to content

Instantly share code, notes, and snippets.

View fogleman's full-sized avatar

Michael Fogleman fogleman

View GitHub Profile
@fogleman
fogleman / polygons.py
Last active August 29, 2015 14:02
Tiling of Regular Polygons
from math import sin, cos, tan, pi, atan2
import cairo
import random
COLORS = [
0x477984,
0xEEAA4D,
0xC03C44,
0xFEF5EB,
]
@fogleman
fogleman / bot.py
Last active August 29, 2015 14:02
Polygon Tiling G-code
from tile import Model, Shape
def normalize(x, y):
return (round(x + 3.5, 6), round(y + 3.5, 6))
def create_model():
model = Model(width=700, height=700, scale=100)
model.append(Shape(6))
a = model.add(0, range(6), 4)
b = model.add(a, 1, 3)
@fogleman
fogleman / nouns.txt
Created June 17, 2014 15:00
Common Nouns
act
air
ant
arm
art
bag
bat
bed
bee
bit
@fogleman
fogleman / main.py
Last active August 29, 2015 14:02
Electric Fields
from math import hypot, atan2, sin, cos, pi, radians
import cairo
import colorsys
import random
class Model(object):
def __init__(self):
self.particles = []
def add(self, x, y, m=1.0):
self.particles.append((x, y, m))
@fogleman
fogleman / main.py
Last active August 29, 2015 14:03
Poisson Disc
from math import pi, sin, cos, hypot, floor
import cairocffi as cairo
import random
R = 0.012
class Grid(object):
def __init__(self, r):
self.r = r
self.size = r / 2 ** 0.5
@fogleman
fogleman / main.py
Last active August 29, 2015 14:03
Poisson Disc + Voronoi
from math import pi, sin, cos, hypot, floor
from pyhull.voronoi import VoronoiTess
from shapely.geometry import Polygon
import cairocffi as cairo
import colorsys
import random
R = 0.02
FILL = 0x422B36
@fogleman
fogleman / main.py
Last active January 2, 2024 10:41
Collision Avoidance
from collections import deque
from math import sin, cos, pi, atan2, hypot
import random
import time
import wx
SIZE = 600
COUNT = 64
SPEED = 100
FOLLOWERS = 4
@fogleman
fogleman / words.md
Last active May 3, 2024 14:43
Mnemonic Encoding Word List

Mnemonic Encoding Word List

http://web.archive.org/web/20090918202746/http://tothink.com/mnemonic/wordlist.html

  • The wordlist contains 1626 words.
  • All words are between 4 and 7 letters long.
  • No word in the list is a prefix of another word (e.g. visit, visitor).
  • Five letter prefixes of words are sufficient to be unique.
  • The words should be usable by people all over the world. The list is far from perfect in that respect. It is heavily biased towards western culture and English in particular. The international vocabulary is simply not big enough. One can argue that even words like "hotel" or "radio" are not truly international. You will find many English words in the list but I have tried to limit them to words that are part of a beginner's vocabulary or words that have close relatives in other european languages. In some cases a word has a different meaning in another language or is pronounced very differently but for the purpose of the encoding it is still ok - I assume that when the encoding is
@fogleman
fogleman / split.py
Last active August 29, 2015 14:04
Python Split Function
def split(values, func):
group = []
previous = None
for value in values:
if previous and func(previous, value):
yield group
group = []
group.append(value)
previous = value
if group:
@fogleman
fogleman / main.py
Created August 23, 2014 16:16
PDS IMG to 3D Mesh
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'