Skip to content

Instantly share code, notes, and snippets.

View remydavid's full-sized avatar

Rémy DAVID remydavid

  • Veolia
  • Paris
View GitHub Profile
@remydavid
remydavid / gist:d3d2cec640d290e2ca44
Created August 25, 2014 08:06
Bleno/Noble interaction bug
var bleno = require('bleno');
var noble = require('noble');
var currentPeripheral = null;
noble.on('stateChange', function(state) {
console.log("stateChange " + state);
if (state === 'poweredOn') {
console.log("start peripheral discovery");
noble.startScanning();
startIBeaconAdvertising();
{
"name": "data-studio-refresh-monkey",
"version": "1.0.0",
"description": "Headless Chrome script to refresh Data Studio reports",
"main": "app.js",
"scripts": {
"start": "node app.js"
},
"engines": {
"node": "8.x.x"
const puppeteer = require('puppeteer');
(() => {
const urls = [
'https://datastudio.google.com/u/0/reporting/XXX' // url for report 1
'https://datastudio.google.com/u/0/reporting/YYY' // url for report 2
// ...
];
// helper function to check if a CSS element is present on the page
@remydavid
remydavid / app.js
Last active December 4, 2018 09:18
const winston = require('winston');
const monkey = require('./data-studio-monkey-refresher');
const express = require('express');
(async () => {
const Logger = winston.Logger;
const Console = winston.transports.Console;
// Imports the Google Cloud client library for Winston
const LoggingWinston = require('@google-cloud/logging-winston').LoggingWinston;
runtime: nodejs8
service: data-studio-monkey-refresher
instance_class: F4_1G #recommanded instance for headless Chrome see https://cloud.google.com/appengine/docs/standard/nodejs/using-headless-chrome-with-puppeteer
cron:
- description: update Data Studio reports
url: /
schedule: every 2 minutes from 05:00 to 18:00 #UTC so translate to 7am to 8pm CET
target: data-studio-monkey-refresher