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
# stepper.py | |
# A micropython driver for 4-phase, unipolar stepper motors such as | |
# the 28BYJ-48 | |
# Relesed to the Public Domain by Nicko van Someren, 2020 | |
# The constructor for the Stepper class takes as arguments the four | |
# pins for driving the motor phases, in phase order, and optionally a | |
# timer. The pins can be passed as pin numbers or machine.Pin objects |
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
ofPolyline temp; | |
float ff = ofGetElapsedTimef(); | |
for (int i = 0; i < 100; i++){ | |
float angle = ofMap(i, 0, 100, 0, TWO_PI); | |
ofPoint pt= ofPoint(400,400); | |
float radius = 200 + ofSignedNoise(ff*0.1, cos(angle)*0.3, sin(angle)*0.3) * 100; | |
pt += radius * ofPoint(cos(angle), sin(angle)); | |
temp.addVertex(pt); | |
} | |
temp.setClosed(true); |
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
// Sobel Edge Detection Filter | |
// GLSL Fragment Shader | |
// Implementation by Patrick Hebron | |
uniform sampler2D texture; | |
uniform float width; | |
uniform float height; | |
void make_kernel(inout vec4 n[9], sampler2D tex, vec2 coord) | |
{ |
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
// Templates inside SVG won't work in polymer-1.0 without some monkeypatching. | |
(function(){ | |
var doc = document.currentScript.ownerDocument; | |
var root = doc.querySelector('dom-module > template').content; | |
var templates = root.querySelectorAll('svg template'); | |
var el, template, attribs, attrib, count, child, content; | |
for (var i=0; i<templates.length; i++) { | |
el = templates[i]; | |
template = el.ownerDocument.createElement('template'); | |
el.parentNode.insertBefore(template, el); |
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
wifi.setmode(wifi.STATION) | |
wifi.sta.config("creationix","noderocks") | |
wifi.sta.connect() | |
tmr.alarm(0, 1000, 1, function () | |
local ip = wifi.sta.getip() | |
if ip then | |
tmr.stop(0) | |
print(ip) | |
dofile("websocket.lc") | |
dofile("main.lc") |
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
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine | |
# This is how I upload my new Sol Trader builds (http://soltrader.net) | |
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash | |
S3KEY="my aws key" | |
S3SECRET="my aws secret" # pass these in | |
function putS3 | |
{ | |
path=$1 |
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
<html> | |
<head> | |
<script src="gif.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/p5.js/0.3.11/p5.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/p5.js/0.3.11/addons/p5.dom.js"></script> | |
<script src="sketch.js"></script> | |
</head> | |
<body> | |
<p>First, allow camera access.<p><p>Then click once to start recording, and another time finish recording and make a gif.</p> | |
</body> |
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
var sync = function(){console.log('sync')} | |
var leftPage = false | |
var t = 0; | |
var c = function(){ | |
if((Date.now()-t) > 500){ | |
leftPage=true | |
} | |
else if(leftPage){ | |
leftPage=false; sync() | |
}; |
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
#!/bin/bash | |
git add -A && git commit -m "yolo" && git push $1 $2 |
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
process.env.NODE_ENV = process.env.NODE_ENV || 'test'; | |
require('dotenv').load(); | |
var keystone = require('keystone'); | |
var chai = require('chai'); | |
var dbURI = process.env.MONGO_URL | |
keystone.init({ | |
'name': 'Post Model Test', | |
's3 config': {} //has to be set, but isn't used in our models |
NewerOlder