Skip to content

Instantly share code, notes, and snippets.

View alexellis's full-sized avatar
📖
Check out my eBook on Go

Alex Ellis alexellis

📖
Check out my eBook on Go
View GitHub Profile
@alexellis
alexellis / twitter2slackbot.js
Created May 31, 2016 20:43
Twitter2SlackBot - watches Hashtags and pushes them into your selected slack channel.
// Needs a config.json file with slack and twitter keys/secrets/tokens.
// Sample config at end of file.
"use strict"
let util = require('util')
var Twitter = require('twitter');
let config = require('./config.json');
let async = require('async');
@alexellis
alexellis / twitter2slackbot.js
Last active May 31, 2016 21:09
Twitter2SlackBot - watches Hashtags and pushes them into your selected slack channel.
"use strict"
// Needs a config.json file with slack and twitter keys/secrets/tokens.
// Sample config at end of file.
let util = require('util')
var Twitter = require('twitter');
let config = require('./config.json');
let async = require('async');
let fs = require('fs');
@alexellis
alexellis / enviroflux.py
Last active July 29, 2016 08:29
Post enviro-phat data into InfluxDB
# You can start an influxDB + grafana instance through Docker + docker-compose: see my gist here:
# https://gist.github.com/alexellis/ce7253d48b6d5a83ca17790ea6249c9b
import time
from envirophat import weather, leds
from influxdb import InfluxDBClient
# set this variables, influxDB may well be localhost
host = "192.168.0.x"
port = 8086
@alexellis
alexellis / docker-compose.yml
Last active August 5, 2016 21:37
InfluxDB plus Grafana example
# This file will download + start up InfluxDB and Grafana and configure them for you.
# Then head over to localhost:3000, password: admin/admin.
# Add a datasource for InfluxDB and then add a dashboard and pick the meaurements you want to see.
version: "2.0"
services:
influx:
image: influxdb
ports:
- "8083:8083"
- "8086:8086"
@alexellis
alexellis / Dockerfile.slack
Created August 1, 2016 18:52
Slack Dockerfile for 2.1.0
FROM debian:stretch
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
RUN apt-get update && apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gconf2 \
@alexellis
alexellis / flux.py
Last active August 12, 2016 02:36
My Pimoroni script to input into InfluxDB
# This script outputs sensor data to InfluxDB which can then be dashboard'd and graph'd through Grafana.
# The script runs on the Pi, Grafana + InfluxDB run on a PC through Docker or manually as installed applications.
# For using Docker on your PC use my docker-compose.yml file: https://gist.github.com/alexellis/ce7253d48b6d5a83ca17790ea6249c9b
# When Grafana is up + running, this JSON file contains the configured dashboard:
# https://gist.github.com/alexellis/74ec5f682d5790d4985c5d50b30bc3b5
# This program is to be run on each Pi with Envirophat.
@alexellis
alexellis / grafana.envirophat.json
Created August 5, 2016 22:24
Grafana dashboard.json for Envirophat
{
"id": 1,
"title": "Environment",
"tags": [],
"style": "dark",
"timezone": "browser",
"editable": true,
"hideControls": false,
"sharedCrosshair": false,
"rows": [
@alexellis
alexellis / ultrasonic.py
Created August 10, 2016 18:52
Ultrasonic sensor for use with Explorer/p/Hat
# Copyright Alex Ellis 2016
# License: MIT
import RPi.GPIO as GPIO
import time
class distanceMeasure:
def __init__(self,trigger,echo):
self.GPIO_ECHO=echo
self.GPIO_TRIGGER=trigger
@alexellis
alexellis / ultrasonic.py
Created August 10, 2016 18:52
Ultrasonic sensor for use with Explorer/p/Hat
# Copyright Alex Ellis 2016
# License: MIT
import RPi.GPIO as GPIO
import time
class distanceMeasure:
def __init__(self,trigger,echo):
self.GPIO_ECHO=echo
self.GPIO_TRIGGER=trigger
@alexellis
alexellis / ultrasonic.py
Created August 10, 2016 18:52
Ultrasonic sensor for use with Explorer/p/Hat
# Copyright Alex Ellis 2016
# License: MIT
import RPi.GPIO as GPIO
import time
class distanceMeasure:
def __init__(self,trigger,echo):
self.GPIO_ECHO=echo
self.GPIO_TRIGGER=trigger