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
// Created by Christopher & Jessica Hogan 2017 | |
#include <Time.h> | |
#include <TimeLib.h> | |
#include <FastLED.h> | |
#include <Adafruit_NeoPixel.h> | |
#ifdef __AVR__ | |
#include <avr/power.h> | |
#endif | |
#define PI_PIN 8 | |
#define NUM_PI_PIXELS 13 |
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
import bpy, numpy | |
from mathutils import * | |
radius = 20 | |
n_samples = 25 | |
samples = numpy.random.multivariate_normal([-0.5, -0.5], [[radius, 0],[0, radius]], n_samples) | |
for point in range(0, len(samples)): | |
locX = samples[point][0] | |
locY = samples[point][1] | |
bpy.ops.mesh.primitive_cube_add(location=(locX,locY,0)) | |
if(numpy.random.sample() > 0.5): |
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
# Imports OBJ meshes, about 2 MB each, and then duplicates the meshes, inserting keyframes for each object | |
# resulting file is > 100 MB | |
import bpy, numpy | |
from mathutils import * | |
radius = 50 | |
n_samples = 25 | |
bpy.ops.import_scene.obj(filepath="./woman_standing.obj") |
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
const repl = require('repl') | |
const Koa = require('koa') | |
const app = new Koa() | |
app.context.defaultMsg = "Hello World" | |
app.use( ctx => ctx.body = app.context.defaultMsg ) | |
app.listen(3000) | |
repl.start({prompt: '> ', eval: myEval}); |
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 blender-python script that generates a normal distribution of cubes and ico-spheres | |
# then animates a subset of the objects, levitating a few objects into a line to the left and a few to the right | |
import bpy, numpy | |
from mathutils import * | |
radius = 30 | |
n_samples = 50 | |
samples = numpy.random.multivariate_normal([-0.5, -0.5], [[radius, 0],[0, radius]], n_samples) #returns an array of arrays |
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
import bpy | |
from mathutils import * | |
from math import pi # wasn't necessary on my mac, but my coworker threw an error without it ¯\_(ツ)_/¯ | |
bpy.ops.object.text_add() | |
textObject = bpy.context.active_object # the object just addded to the scene becomes the active object of the context | |
textObject.data.body = "hello\nworld!" | |
bpy.ops.object.origin_set(type="ORIGIN_GEOMETRY") # set the origin (center of rotation) of the shape to it's geometric center | |
textObject.rotation_euler[0] = pi / 2 #rotation euler is an array-like, [x,y,z], so this is 90 deg x axis rotation in radians! |
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
import bpy, numpy | |
from mathutils import * | |
radius = 150 | |
n_samples = 30 | |
bpy.ops.import_scene.obj(filepath="./woman.obj") # the 4 different meshes that make up woman.obj will be selected but not active | |
bpy.context.scene.objects.active = bpy.data.objects[0] # join requires there to be a selected object, not just active | |
bpy.ops.object.join() | |
bpy.data.objects[0].name = 'woman' #17,938 vertices |
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
const fs = require('fs') | |
const exec = require('child_process').exec | |
const http = require('http') | |
http.createServer((request,response) => ({ | |
'GET': () => fs.createReadStream('.' + request.url, 'utf8') | |
.on('error', err => response.end(JSON.stringify(err))) | |
.pipe(response), | |
'POST': () => exec(decodeURI(request.url.split('?')[1])).stdio.forEach(stdio => stdio.pipe(response)), | |
'PUT': () => request.pipe(fs.createWriteStream('.' + request.url, 'utf8')) | |
.on('finish', () => response.end()), |
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
function createUpdatePos({clientX, clientY}){ //this is a function creator. When a mouse/touchdown event occurs, the initial position | |
var theLastX = clientX //is enclosed in a function, those variables are updated on mousemove and will persist | |
var theLastY = clientY //as long as the function exists. On touch/mouseup events, the function is destroyed (the variable it was assigned to is reassigned null) | |
return function({clientX, clientY, buttons}){ | |
var movementX = clientX - theLastX | |
var movementY = clientY - theLastY | |
theLastX = clientX | |
theLastY = clientY | |
var currentXpos = parseInt(document.activeElement.style.left) | |
var currentYpos = parseInt(document.activeElement.style.top) |
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
using System.Collections.Generic; | |
using System.Linq; | |
using UnityEngine; | |
using UnityEngine.Windows.Speech; | |
public class cubeFollow : MonoBehaviour { | |
private string mode = "none"; |