Skip to content

Instantly share code, notes, and snippets.

function Sphere(iterations) {
// returns an object with a 'draw' method
// we cache ready-built spheres
if(!Sphere.spheres)
Sphere.spheres = [];
if(iterations in Sphere.spheres)
return Sphere.spheres[iterations];
// we have to create it...
var vertices = [],
vIndex = {},
import sys
queue = ["a"+"-"*9]
boards = {queue[0]:set()}
ends = set()
next = {"a":"b","b":"a"}
def won(side,board):
line = side*3
@williame
williame / gist:4087256
Created November 16, 2012 13:12
a dot-file for all moves in a simple tic-tac-toe-like game
digraph luffarschack {
node [shape=none];
"baabb--ba-" [label=<<TABLE BORDER="1" BGCOLOR="white">
<TR><TD BGCOLOR="red"></TD><TD BGCOLOR="red"></TD><TD BGCOLOR="blue"></TD></TR>
<TR><TD BGCOLOR="blue"></TD><TD BGCOLOR="white"></TD><TD BGCOLOR="white"></TD></TR>
<TR><TD BGCOLOR="blue"></TD><TD BGCOLOR="red"></TD><TD BGCOLOR="white"></TD></TR>
</TABLE>>];
"baabb--ba-" -> "abbaa-a-b-";
"baabb--ba-" -> "ab-aaba--b";
"baabb--ba-" -> "abbaaba---";
import signal, time, traceback, threading
def start(interval=0.1):
global _interval, _samples
_samples = []
signal.signal(signal.SIGALRM,_sample)
signal.setitimer(signal.ITIMER_REAL,interval,interval)
def stop():
global _samples
from PIL import Image, ImageDraw, ImageSequence
from random import random as rnd
from math import sqrt
def vec3_scale(v,f):
return (v[0]*f,v[1]*f,v[2]*f)
def vec3_add(a,b):
return (a[0]+b[0],a[1]+b[1],a[2]+b[2])
from PIL import Image, ImageDraw, ImageSequence
from random import random as rnd
from math import sqrt
def vec3_scale(v,f):
return (v[0]*f,v[1]*f,v[2]*f)
def vec3_add(a,b):
return (a[0]+b[0],a[1]+b[1],a[2]+b[2])
<html><head><title> 165888,79872 </title></head><body><table cellspacing="0" cellpadding="0">
<tr>
<td><img src="http://imgs.xkcd.com/clickdrag/48n0e.png" alt=""/>
<td><img src="http://imgs.xkcd.com/clickdrag/48n1e.png" alt=""/>
<td><img src="http://imgs.xkcd.com/clickdrag/48n2e.png" alt=""/>
<td><img src="http://imgs.xkcd.com/clickdrag/48n3e.png" alt=""/>
<td><img src="http://imgs.xkcd.com/clickdrag/48n4e.png" alt=""/>
<td><img src="http://imgs.xkcd.com/clickdrag/48n5e.png" alt=""/>
<td><img src="http://imgs.xkcd.com/clickdrag/48n6e.png" alt=""/>
<td><img src="http://imgs.xkcd.com/clickdrag/48n7e.png" alt=""/>
size=[14,48,25,33]
tilesize=2048
map_size=[(size[1]+size[3])*tilesize,(size[0]+size[2])*tilesize]
print '<html><head><title>',",".join("%s"%i for i in map_size),'</title></head><body><table cellspacing="0" cellpadding="0">'
for ns in "ns":
for y in range(48):
print "<tr>"
for x in range(25):
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>Collar7854</name>
<description>GPS Plus - http://www.vectronic-aerospace.com</description>
<Style id="FirstFix">
<IconStyle>
<Icon>
<href>http://maps.google.com/mapfiles/kml/shapes/square.png</href>
</Icon>
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>Collar9007</name>
<description>GPS Plus - http://www.vectronic-aerospace.com</description>
<Style id="FirstFix">
<IconStyle>
<Icon>
<href>http://maps.google.com/mapfiles/kml/shapes/square.png</href>
</Icon>