Skip to content

Instantly share code, notes, and snippets.

View duhaime's full-sized avatar

Douglas Duhaime duhaime

View GitHub Profile
@duhaime
duhaime / geb.txt
Created May 12, 2020 18:27
Goedel Escher Bach plaintext
This file has been truncated, but you can view the full file.
Introduction:
A Musico-Logical Offering
Author: FREDERICK THE GREAT, King of Prussia, came to power in 1740. Although he is emembered in history books mostly for his military astuteness, he was also devoted to he life of the mind and the spirit. His court in Potsdam was one of the great centers of ntellectual activity in Europe in the eighteenth century. The celebrated mathematician
Leonhard Euler spent twenty-five years there. Many other mathematicians and scientists ame, as well as philosophers-including Voltaire and La Mettrie, who wrote some of their ost influential works while there. But music was Frederick's real love. He was an avid flutist and composer. Some of his ompositions are occasionally performed even to this day. Frederick was one of the first atrons of the arts to recognize the virtues of the newly developed "piano-forte" ("softloud"). The piano had been developed in the first half of the eighteenth century as a odification of the harpsichord. The problem with the harpsichord was that pieces
@duhaime
duhaime / cat.jpg
Last active December 9, 2024 14:41
Color thief top colors
cat.jpg
@duhaime
duhaime / get_max_texture_size.js
Created April 28, 2018 01:46
Get Max Supported WebGL Texture Size on Host Device
const gl = document.createElement('canvas').getContext('webgl');
console.log(gl.getParameter(gl.MAX_TEXTURE_SIZE))
@duhaime
duhaime / measure_img_similarity.py
Last active September 10, 2024 20:14
Compare image similarity in Python using Structural Similarity, Pixel Comparisons, Wasserstein Distance (Earth Mover's Distance), and SIFT
import warnings
from skimage.measure import compare_ssim
from skimage.transform import resize
from scipy.stats import wasserstein_distance
from scipy.misc import imsave
from scipy.ndimage import imread
import numpy as np
import cv2
##
@duhaime
duhaime / .gitignore
Last active July 29, 2024 01:24
Points Scale Testing
.ipynb_checkpoints
*.pyc
*.pem
*.swp
*.json
*.DS_Store
/**
* Loads a Wavefront .mtl file specifying materials
*
* @author angelxuanchang
*/
THREE.MTLLoader = function ( manager ) {
this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
@duhaime
duhaime / TrackballControls.js
Last active July 29, 2024 01:24
Using canvas textures in three.js
THREE.TrackballControls=function(e,t){var o=this,n={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.keys=[65,83,68],this.target=new THREE.Vector3;var s=new THREE.Vector3,c=n.NONE,a=n.NONE,i=new THREE.Vector3,r=new THREE.Vector2,p=new THREE.Vector2,h=new THREE.Vector3,d=0,u=new THREE.Vector2,E=new THREE.Vector2,m=0,l=0,g=new THREE.Vector2,y=new THREE.Vector2;this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.up0=this.object.up.clone();var v={type:"change"},w={type:"start"},T={type:"end"};this.handleResize=function(){if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{var
@duhaime
duhaime / GLTFLoader.js
Last active July 29, 2024 01:24
Tiny Dancer
/**
* @author Rich Tibbett / https://github.com/richtr
* @author mrdoob / http://mrdoob.com/
* @author Tony Parisi / http://www.tonyparisi.com/
* @author Takahiro / https://github.com/takahirox
* @author Don McCurdy / https://www.donmccurdy.com
*/
THREE.GLTFLoader = ( function () {
@duhaime
duhaime / .block
Last active July 29, 2024 01:24
Text Matches Browser Concept
license: MIT
height: 800
scrolling: no
border: yes
@duhaime
duhaime / TrackballControls.js
Last active July 29, 2024 01:24
Particle Dance
THREE.TrackballControls=function(e,t){var o=this,n={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.keys=[65,83,68],this.target=new THREE.Vector3;var s=new THREE.Vector3,c=n.NONE,a=n.NONE,i=new THREE.Vector3,r=new THREE.Vector2,p=new THREE.Vector2,h=new THREE.Vector3,d=0,u=new THREE.Vector2,E=new THREE.Vector2,m=0,l=0,g=new THREE.Vector2,y=new THREE.Vector2;this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.up0=this.object.up.clone();var v={type:"change"},w={type:"start"},T={type:"end"};this.handleResize=function(){if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{var