This file contains hidden or 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
#!/usr/bin/ruby | |
USAGE = "dataurize filename [mimetype] > filename.dataURI" | |
require 'base64' | |
mime = ARGV[1] || `file -ib '#{ARGV[0].gsub(/'/, "'\\\\''")}'`.strip | |
STDOUT.write("data:#{mime};base64,") | |
File.open(ARGV[0], 'rb') {|f| | |
STDOUT.write(Base64.encode64(f.read(4500))) until f.eof? |
This file contains hidden or 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
TarGZ = function(){}; | |
// Load and parse archive, calls onload after loading all files. | |
TarGZ.load = function(url, onload, onstream, onerror) { | |
var o = new TarGZ(); | |
o.onload = onload; | |
o.onerror = onerror; | |
o.onstream = onstream; | |
o.load(url); | |
return o; |
This file contains hidden or 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
BlenderExport.tmpVec = vec4.create(); | |
BlenderExport.tmpNo = vec4.create(); | |
BlenderExport.rv = vec3.create(); | |
BlenderExport.nrv = vec3.create(); | |
BlenderExport.v = vec4.create(); | |
BlenderExport.n = vec4.create(); | |
BlenderExport.setFrame = function(frame) { | |
if (!this.frameVertices) | |
this.frameVertices = new Float32Array(this.vertices); |
This file contains hidden or 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
5-year-period histogram of the top 100 sci-fi books | |
based on http://home.austarnet.com.au/petersykes/topscifi/lists_books_rank1.html | |
1800-1804: | |
1805-1809: | |
1810-1814: | |
1815-1819: # | |
1820-1824: | |
1825-1829: | |
1830-1834: |
This file contains hidden or 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
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: usr-prefetch | |
# Required-Start: $remote_fs | |
# Required-Stop: $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Prefetch system files to page cache. | |
# Description: Prefetches files under /opt, /usr and /etc, and the FS entries for /. | |
### END INIT INFO |
This file contains hidden or 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
DrawHistorySerializer = Klass({ | |
magic: 'SRBL', | |
majorVersion: 0, | |
minorVersion: 0, | |
getVersionTag : function() { | |
return [this.magic, this.majorVersion, this.minorVersion, ''].join(",") | |
}, | |
serialize : function(history) { |
This file contains hidden or 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
#!BPY | |
""" | |
Name: 'WebGL JavaScript (.js)' | |
Blender: 249 | |
Group: 'Export' | |
Tooltip: 'WebGL JavaScript' | |
""" | |
# -------------------------------------------------------------------------- |
This file contains hidden or 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
BlenderExport.splitByMaterial = function(matIndexes, verts, sz) { | |
var matVerts = []; | |
for (var i=0; i<matIndexes.length; i++) { | |
var idx = matIndexes[i]; | |
if (matVerts[idx] == null) { | |
matVerts[idx] = []; | |
} | |
for (var j=0; j<sz; j++) { | |
matVerts[idx].push(verts[i*sz + j]); |
This file contains hidden or 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
// Prototyping a test harness autogen | |
// Here's a run against Array.prototype | |
Test_Array = { | |
run_tests : function() { | |
for (var i in this) { | |
if (/^test_/.test(i)) { | |
var __obj = new Array(args); | |
this[i](__obj); | |
} |
This file contains hidden or 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
/* | |
Object.extend(Float32Array.prototype, ArrayMixin); | |
var vecf32 = function(arg){ return new Float32Array(arg); }; | |
var a = vecf32([1,2,3,4,5,6]); | |
// (1,2,3,4,5,6) | |
a.filter(function(v) { return v>3; }); | |
// (4,5,6) | |
a.reverse(); | |
// (6,5,4,3,2,1) | |
a.replaceSlice(1,-1, vecf32([100, 200])); |