Skip to content

Instantly share code, notes, and snippets.

@dceejay
dceejay / pi2nodered.sh
Last active August 29, 2015 14:15
Pi 2 Node-RED install (and run) script
#! /bin/bash
### This is for Pi Version 2 ONLY
### Once it completes Node-RED should be ready to run...
### To do this all in one command... copy and paste just the following command
### curl -sL https://gist.githubusercontent.com/dceejay/ab527322584c3600f293/raw/ | bash -
cd ~
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y build-essential python-dev python-rpi.gpio nodejs
node -v
@dceejay
dceejay / pinodered.sh
Last active August 29, 2015 14:15
Pi Node-RED install (and run) script
#! /bin/bash
### This is for Pi Version 1 ONLY
### Once it completes Node-RED should be ready to run...
### To do this all in one command... copy and paste just the following command
### curl -sL https://gist.githubusercontent.com/dceejay/250502b143efcdc57fed/raw/ | bash -
cd ~
sudo apt-get update && sudo apt-get install -y build-essential python-dev python-rpi.gpio
wget http://node-arm.herokuapp.com/node_0.10.36_armhf.deb
sudo dpkg -i node_0.10.36_armhf.deb
@dceejay
dceejay / gist:72d92bb5fba32b1bc83c
Created February 23, 2015 22:08
TCP request example
[{"id":"718554ed.8e7aac","type":"inject","name":"","topic":"","payload":"hello","payloadType":"string","repeat":"","crontab":"","once":false,"x":151,"y":457,"z":"6b5c7d92.94a384","wires":[["31a4d6ce.ce5b2a"]]},{"id":"31a4d6ce.ce5b2a","type":"tcp request","server":"192.168.1.10","port":"55555","out":"time","splitc":"100","name":"","x":353,"y":507,"z":"6b5c7d92.94a384","wires":[["4e62b5b1.b19d4c"]]},{"id":"4e62b5b1.b19d4c","type":"function","name":"only pass changes","func":"\ncontext.old = context.old || \"\";\nmsg.payload = msg.payload.toString();\n\nif (msg.payload !== context.old) {\n context.old = msg.payload;\n return msg;\n}\nreturn null;","outputs":1,"valid":true,"x":551,"y":566,"z":"6b5c7d92.94a384","wires":[["f43c9e61.0bc36"]]},{"id":"253b6ef0.dac492","type":"inject","name":"","topic":"","payload":"goodbye","payloadType":"string","repeat":"","crontab":"","once":true,"x":151,"y":532,"z":"6b5c7d92.94a384","wires":[["31a4d6ce.ce5b2a"]]},{"id":"f43c9e61.0bc36","type":"debug","name":"","active":true,
@dceejay
dceejay / gist:6f0742ddce6fa02d6f40
Created March 1, 2015 18:35
NeoPixelSerial.ino
#include <Adafruit_NeoPixel.h>
#define PIN 4
int led = 13;
// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
@dceejay
dceejay / README.md
Last active December 23, 2015 03:19
Get UK Power Demand

#Read UK Power Demand

Uses the web service from the National Grid to fetch the current overall UK Electricity Demand.

    http://realtimeweb-prod.nationalgrid.com/SystemData.aspx

The reponse is then parsed into two parts.

  • The first is an object containing the power in MW and the operating frequency in Hertz
  • The second is true/false depending if that frequency is above 50Hz.
@dceejay
dceejay / README.md
Last active January 2, 2016 18:19
Range node simple test flow

Range Node Tester

Simple example to exercise the range node...

@dceejay
dceejay / rebuildPiKernel.sh
Created January 18, 2016 23:03
Rebuild/Patch Pi kernel for Pizero microUSB 3Port USB/Ethernet hub...
#!/bin/bash
# Rebuild Pi kernel
sudo apt-get -y update
sudo apt-get -y dist-upgrade
sudo apt-get -y install gcc make bc ncurses-dev build-essential git
sudo apt-get -y autoremove --purge
sudo apt-get -y autoclean
git clone --depth 1 git://github.com/raspberrypi/linux.git
@dceejay
dceejay / README.md
Last active February 9, 2017 12:13
Plotting planes using dump1090 and worldmap.
@dceejay
dceejay / Dockerfile
Last active November 24, 2020 15:39
Dockerfile for Node-RED
# Dockerfile for Node-RED - pulls latest master code from git
# Use the node.js v4 LTS engine
FROM node:4-slim
MAINTAINER ceejay
RUN mkdir -p /root/.node-red
WORKDIR /root/.node-red
# download latest stable node-red
RUN npm install -g --unsafe-perm node-red
@dceejay
dceejay / main.cpp
Last active January 5, 2021 19:57
Wemos temperature monitor
#include <Arduino.h>
/* DS18B20 Temperature sensors - Deep Sleep - with Wifi and MQTT
*
* Connections:
* D0 -- RST
* Uses the folowing platformio.ini file
[env:d1_mini]
platform = espressif8266