Skip to content

Instantly share code, notes, and snippets.

View joelongstreet's full-sized avatar

Joe Longstreet joelongstreet

View GitHub Profile
const ffmpeg = require('fluent-ffmpeg');
const c = new ffmpeg('video1.mp4')
.addInput('video2.mp4')
.on('error', function(err) {
console.log('an error happened: ' + err.message);
})
.on('end', function() {
console.log('final video saved');
})
#!/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 December 13, 2017 13:35
Resin.io DockerFile - Node, Bower, Chromium
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\
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 February 17, 2015 03:24
Listen for GPIO input from a raspberry pi - open menu and power off
# 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
int sensorPin = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
//getting the voltage reading from the temperature sensor
#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 July 11, 2014 16:55
Short example on how to control a stepper motor
int M1dirpin = 4;
int M1steppin = 5;
void setup()
{
pinMode(M1dirpin,OUTPUT);
pinMode(M1steppin,OUTPUT);
digitalWrite(M1dirpin,LOW);
}
@joelongstreet
joelongstreet / ColdPi
Last active August 29, 2015 14:03
A node script for a raspberry pi which collects temperature data and logs it to a .csv
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
});