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
// Tiny TFJS train / predict example. | |
async function myFirstTfjs() { | |
// Create a simple model. | |
const model = tf.sequential(); | |
model.add(tf.layers.dense({units: 1, inputShape: [1]})); | |
// Prepare the model for training: Specify the loss and the optimizer. | |
model.compile({ | |
loss: 'meanSquaredError', | |
optimizer: 'sgd' |
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
var mqtt = require('mqtt'); | |
var options = { | |
username: 'try', | |
password: 'try' | |
} | |
var client = mqtt.connect('mqtt://broker.shiftr.io', options); | |
client.on('connect', function() { | |
client.subscribe("thebestpets"); | |
client.publish("thebestpets/dogs", "Dogs are really great"); |
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
set dFolder to "~/'Dropbox (Method)'/Projects/'2018-01 The Atlas Project'/screencapture/" | |
do shell script ("mkdir -p " & dFolder) | |
set pathToMouseTools to "Macintosh HD:Users:skoltun:Desktop:bin:MouseTools" | |
set xPos to 957 | |
set yPos to 692 |
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
var url; | |
var mic; | |
var prevState; | |
var lights; | |
function setup() { | |
mic = new p5.AudioIn(); | |
mic.start(); | |
connect(); | |
} |
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
#include <SPI.h> | |
#include <WiFi101.h> | |
#include "ArduinoJson.h" | |
#include "config.h" | |
// Sensors // MK1000 only takes 3.3V | |
int audioPin = A3; // | |
float audioValue = 0.0; | |
int lightPin = A4; // photocell: put with a brown-black-orange resistor | |
float lightValue = 0.0; // or photo transister: red red yellow |
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
projection = d3.geoMercator() | |
.scale([2000000]); // scale things wayyyy up | |
path = d3.geoPath() // path generator that will convert GeoJSON to SVG paths | |
.projection(projection); // tell path generator to use above defined projection | |
d3.json('Manhattan-Blocks.geojson', function(error, mapData) { | |
var features = mapData.features; | |
features.sort(function(x, y){ | |
return d3.descending(x.properties.area, y.properties.area); |
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
var roofObject = require('./roofObject.js'); | |
var dateFormat = require('dateformat'); | |
module.exports = { | |
addReading: function(request, response) { | |
console.log("add new reading"); | |
var now = new Date(); | |
var timeFormatted = dateFormat(now, "isoDateTime"); |
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
var roofObject = require('./roofObject.js'); | |
module.exports = { | |
getLatest: function(request, response) { | |
response.send(roofObject.readings[roofObject.readings.length-1]); | |
}, | |
getAll: function(request, response) { | |
response.send(roofObject.readings); | |
}, |
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
var express = require('express'); // include express.js | |
var app = express(); // a local instance of it | |
var bodyParser = require('body-parser'); // include body-parser | |
var getRequest = require('./getRequest.js'); | |
var postRequest = require('./postRequest.js'); | |
// you need a couple of parsers for the body of a POST request: | |
app.use(bodyParser.json()); // for application/json | |
app.use(bodyParser.urlencoded({extended: false})); // for application/x-www-form-urlencoded | |
app.use(express.static('public')); |
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
var limit = 50; // number of results to return | |
var offset = 0; // position where to start returning from | |
app.get("/compareSents", function(req, res) { | |
console.log("compare sentences in batches"); | |
// call the comparison function below | |
compareTheSentences(); | |
// should have a response??? |
NewerOlder