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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script>//<!-- | |
// WebGL texture example | |
top.CanvasFloatArray = top.CanvasFloatArray || WebGLFloatArray; | |
var gl; | |
var program; |
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
<?php | |
// workaround no "gzopen" problem on ubuntu karmic's php5 5.2.10.dfsg.1-2ubuntu6 | |
if (!function_exists("gzopen") && function_exists("gzopen64")) { | |
function gzopen($file, $mode) { | |
return gzopen64($file, $mode); | |
} | |
} | |
?> |
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
# heap queue simple implementation | |
def heappush(heap, val): | |
cur = len(heap) | |
heap.append(val) | |
while cur > 0: | |
parent = (cur - 1) // 2 | |
if heap[parent] <= heap[cur]: break | |
heap[cur], heap[parent] = heap[parent], heap[cur] | |
cur = parent |
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
// A* lib port from pythonic A*: http://gist.github.com/147645 | |
package astar | |
import "container/heap" | |
import "container/vector" | |
// position data for A*: e.g. start and goal. | |
type Location interface { | |
Equals(other Location) bool; | |
// Returned value should be unique for each location value. |
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
// 8g astar.go | |
// 8g -I . astar_main.go | |
// 8l -o astar_main astar_main.go astar.go | |
package main | |
import "fmt" | |
import "math" | |
import "strings" | |
import "astar" |
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
// [X-Mouse setting tool on Windows 7/Vista] | |
// build on 64bit .NET 3.5: | |
// c:\Windows\Microsoft.NET\Framework64\v3.5\csc.exe XMouse.cs | |
// or on 32bit .NET 3.5: | |
// c:\Windows\Microsoft.NET\Framework\v3.5\csc.exe XMouse.cs | |
using Microsoft.Win32; | |
class XMouse { | |
static void Main(string[] args) { | |
if (args.Length == 0 || !(args[0] == "on" || args[0] == "off")) { |
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
// groovy sakura.groovy | |
import javax.sound.midi.* | |
// compose sequence | |
ticks = 16 | |
// compose utils | |
def addNote(track, pitch, start, duration=ticks, velocity=64) { | |
// pitch: C=60, D=62, E=64, F=65, G=67, A=69, B=71, ... | |
// start: absolute time |
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
__doc__ = """Spreadsheet style lazy evaluator | |
""" | |
from collections import defaultdict | |
import traceback | |
__all__ = ["Sheet"] | |
class Sheet(object): | |
"Spreadsheet style lazy evaluation calculator" | |
def __init__(self, empty=0): |
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
"""base64 module (programming training)""" | |
n2ch = "".join([ | |
"ABCDEFGHIJKLMNOPQRSTUVWXYZ", | |
"abcdefghijklmnopqrstuvwxyz", | |
"0123456789+/", | |
]) | |
ch2n = dict(zip(n2ch, range(len(n2ch)))) | |
def separate(seq, size): | |
return (seq[i:i+size] for i in range(0, len(seq), size)) |
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
// access key maps | |
using Microsoft.Win32; | |
class KeyMap { | |
static void Main(string[] args) { | |
// Windows7 does not support Keyboard Layout in CurrentUser | |
//var root = Registry.CurrentUser; | |
//var subkey = @"Keyboard Layout"; // for CurrentUser | |
var root = Registry.LocalMachine; | |
var subkey = @"SYSTEM\CurrentControlSet\Control\Keyboard Layout"; |