Skip to content

Instantly share code, notes, and snippets.

View DazWilkin's full-sized avatar

Daz Wilkin DazWilkin

View GitHub Profile
#include "Adafruit_Si7021.h"
Adafruit_Si7021 sensor = Adafruit_Si7021();
double h;
double t;
void setup() {
sensor.begin();
@DazWilkin
DazWilkin / prometheus.yml
Created January 4, 2018 23:40
Cloud Functions Prometheus Exporter
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
- job_name: 'particles'
scheme: https
scrape_interval: 5m
static_configs:
- targets: ['us-central1-{{YOUR-PROJECT-ID}}.cloudfunctions.net:443']
@DazWilkin
DazWilkin / package.json
Last active January 5, 2018 00:07
Cloud Functions Prometheus Exporter
{
"name": "cloud-functions-prom-exporter",
"version": "0.0.1",
"description": "Cloud Functions originating Prometheus Gauge|Histogram metrics",
"author": "Your Name <[email protected]>",
"keywords": ["Google","Cloud Functions","Prometheus", "Particle", "Photon"],
"dependencies":{
"prom-client": "10.2.2",
"particle-api-js": "7.0.1",
"cloud-functions-runtime-config": "0.2.0"
@DazWilkin
DazWilkin / index.js
Created January 5, 2018 00:09
Cloud Functions Prometheus Exporter
/* jshint strict: true */
/* jshint esversion: 6 */
/* globals exports,require */
const client = require("prom-client");
const Registry = client.Registry;
const register = new Registry();
const Particle = require("particle-api-js");
const particle = new Particle();
# -*-coding=utf-8 -*-
import json
from apiclient.discovery import build
from datetime import datetime, date, time, timedelta
from oauth2client.client import GoogleCredentials
credentials = GoogleCredentials.get_application_default()
@DazWilkin
DazWilkin / cloudbuild.yml
Created January 6, 2018 06:15
A Google Closure Compiler Builder for Container Builder
steps:
- name: busybox
args: ["mv", "index.js", "index.before.js"]
- name: gcr.io/${PROJECT_ID}/google-closure-compiler
args: [
"--js_output_file=index.js",
"index.before.js"
]
- name: gcr.io/cloud-builders/gcloud
args: [
@DazWilkin
DazWilkin / actions.json
Last active January 8, 2018 00:54
First (Worst?) Google Assistant app
{
"actions": [
{
"description": "Default Welcome Intent",
"name": "MAIN",
"fulfillment": {
"conversationName": "silly"
},
"intent": {
"name": "actions.intent.MAIN",
@DazWilkin
DazWilkin / index.js
Created January 8, 2018 01:24
First (Worst?) Google Assistant app
/* jshint strict: true */
/* jshint esversion: 6 */
/* globals exports,require */
const ActionsSdkApp = require('actions-on-google').ActionsSdkApp;
const greet = (intentName) => `Hi, I\'m a silly app. This is the ${intentName} intent. You can ask me something`;
const
intent = {
@DazWilkin
DazWilkin / package.json
Created January 8, 2018 01:25
First (Worst?) Google Assistant app
{
"name": "silly app",
"version": "0.0.1",
"description": "First Google Actions SDK",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"actions-on-google": "^1.7.0"
@DazWilkin
DazWilkin / cloudbuild.yaml
Created January 8, 2018 01:28
First (Worst?) Google Assistant app
steps:
- name: gcr.io/cloud-builders/gcloud
args: [
'beta',
'functions',
'deploy','test',
'--source=https://source.developers.google.com/projects/${PROJECT_ID}/repos/[[YOUR-REPO]]/moveable-aliases/master/paths/',
'--trigger-http',
'--entry-point=test',
'--project=${PROJECT_ID}'