Skip to content

Instantly share code, notes, and snippets.

Avatar

Joe Longstreet joelongstreet

View GitHub Profile
View temp.js
#!/usr/bin/env node
'use strict';
const chalk = require('chalk');
const del = require('del');
const fs = require('fs');
const google = require('googleapis');
const googleAuth = require('google-auth-library');
const _ = require('lodash');
@joelongstreet
joelongstreet / Dockerfile.template
Last active Dec 13, 2017
Resin.io DockerFile - Node, Bower, Chromium
View Dockerfile.template
FROM resin/%%RESIN_MACHINE_NAME%%-node:6.9.1
RUN apt-get update \
&& apt-get install -y \
chromium-browser \
fbset \
htop \
libnss3 \
libraspberrypi-bin \
lsb-release\
View gist:a69bcf69f456a6c26f1956e3e297e902
var url = [
'https://api.spark.io/v1/devices/',
'2d0056001551353531343431',
'/message'
].join('');
var postParams = [
'access_token=',
process.env.SPARK_CORE_TOKEN,
'&params=',
@joelongstreet
joelongstreet / pi-gpio-butons.py
Created Feb 17, 2015
Listen for GPIO input from a raspberry pi - open menu and power off
View pi-gpio-butons.py
# Import the RPi.GPIO and OS
import RPi.GPIO as GPIO
import os
import sys
import time
# GPIO port setup
GPIO.setmode(GPIO.BCM)
# Power switch: will send a shutdown message to the OS
View temp.ino
int sensorPin = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
//getting the voltage reading from the temperature sensor
View ethernet.ino
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x08, 0xA1 };
char server[ ]= "api.mongolab.com";
EthernetClient client;
void setup()
@joelongstreet
joelongstreet / Stepper Motor
Created Jul 11, 2014
Short example on how to control a stepper motor
View Stepper Motor
int M1dirpin = 4;
int M1steppin = 5;
void setup()
{
pinMode(M1dirpin,OUTPUT);
pinMode(M1steppin,OUTPUT);
digitalWrite(M1dirpin,LOW);
}
@joelongstreet
joelongstreet / ColdPi
Last active Aug 29, 2015
A node script for a raspberry pi which collects temperature data and logs it to a .csv
View ColdPi
var fs = require('fs');
var path = require('path');
var gpio = require('gpio');
var filePath = path.join(process.cwd(), 'log.csv');
var tempSensor = gpio.export(4, {
direction: 'in',
interval: 5000,
ready: startApp
});
You can’t perform that action at this time.