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
int sensorPin = 7; // 220 or 1k resistor connected to this pin | |
long threshold = 200; | |
long ambientReading; | |
long ambientReadingCount; | |
bool tripEnabled = false; | |
int LED_PIN = 3; | |
int BUZZER_PIN = 4; | |
int ambientReadingsToTake = 10; |
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
// * Download a tile/thumbnail from the LandSat 8 dataset. | |
// Create directory called 'images' | |
// npm install request path async | |
// node GetNasaEarth lat lon | |
// * How program works | |
// First find all passes by date of the satellite, then request a thumbnail from the API | |
// Follow API through and download the images in batches of 5. | |
// Timing is to off-set throttling on the data-API. |
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
// Author: Alex Ellis 2015 | |
// Sample in node.js for fetching passage from ESV's restful API in plain-text format. | |
// | |
// 1) Save this file as esvlookup.js | |
// | |
// 2) Install module for making HTTP requests | |
// npm install request | |
// 3) Run the program and fetch the passage about being 'born-again' | |
// node lookup.js John 3:1-3 |
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
#define enablePin 2 | |
#define IN1_L 3 | |
#define IN3_R 6 | |
#define IN2_L 5 | |
#define IN4_R 9 | |
int engineSpeed; | |
const int BRAKE=0; | |
const int FORWARDS=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
#define MOTOR_PIN 3 | |
#define SENSOR_VCC 9 | |
#define SENSOR_MOISTURE A2 | |
#define MOISTURE_THRESHOLD 700 | |
#define SENSOR_WARMUP 1200 | |
#define SAMPLE_DELAY 8000 | |
void setup() { | |
pinMode(SENSOR_VCC, OUTPUT); | |
pinMode(MOTOR_PIN, OUTPUT); |
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 redis = require ('node-redis'); | |
var updateCounter = function(done) { | |
var client = redis.createClient("6379",function (err) { | |
if(err) { | |
return console.error(err); | |
} | |
client.incr("hit_counter", function(ierr) { | |
if(ierr) { | |
return console.error(ierr); |
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 AHashtable(size) { | |
this.table = this.init_table(size); | |
} | |
AHashtable.prototype.set = function(key, value) { | |
var self = this; | |
var index = self.jenkins_hash(key, self.table.length); | |
self.table[index] = value; | |
}; |
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 request = require('request'); | |
var async = require('async'); | |
var found = []; | |
async.until(function() { | |
return false; // infinite async-loop, insert counter check here. | |
}, function(cb) { | |
request.head("https://www.raspberrypi.org/blog/the-little-computer-that-could/", | |
function(err, res, 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
module("resty.consul", package.seeall) | |
_VERSION = '0.1.0' | |
function service_nodes(service) | |
local http = require "resty.http" | |
local json = require "cjson" | |
local hc = http:new() | |
local upstream = "" |
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
# This was broken until I changed GPIO.BCM to GPIO.BOARD | |
import RPi.GPIO as GPIO | |
import time | |
import os | |
# Define PiLITEr to GPIO mapping | |
leds = [7,11,13,12,15,16,18,22] | |
GPIO.setmode(GPIO.BOARD) |
OlderNewer