This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { | |
conversation, | |
} = require('@assistant/conversation'); | |
const functions = require('firebase-functions'); | |
const fetch = require('node-fetch'); | |
const app = conversation({debug: true}); | |
const URL = 'https://<YOUR FUNCTION URL>.cloudfunctions.net/automower'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
from flask import abort, escape | |
from google.cloud import firestore | |
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'sa_key.json' | |
def get_automower(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import datetime | |
import time | |
from shapely import geometry | |
import geopandas as gpd | |
import pandas as pd | |
import requests | |
import timeago |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import requests | |
import time | |
from prometheus_client import Gauge, start_http_server | |
# Source: github.com/chrisz/pyhusmow | |
# ./husmow --login <> --password <> server | |
DATA_API = 'http://127.0.0.1:1234/status' | |
PORT_API = 8182 | |
TIME_BETWEEN_CHECKS_SECONDS = 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var saveDoc = async function(data) { | |
const saveData = { | |
...data, | |
...{ savedTimestamp: admin.firestore.FieldValue.serverTimestamp() } | |
} | |
db.collection('Auth').doc(data.team_id).set(saveData).then(res => { | |
console.log('Auth data updated for:', data.team_id); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query.get() | |
.then((doc) => { | |
if (!doc.exists) { | |
console.log('Item: No such document for:', loggingEvent); | |
collection.add(item) | |
.then((documentReference) => { | |
console.log(`Added item with ref/id: ${documentReference.id}`); | |
track('Wrote Message to DB Completed', { | |
team: item.team, | |
channel: item.channel, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Promise.all([ | |
parseIncoming, | |
delegateReader, | |
writeDb, | |
writeSummary, | |
preCache, | |
]) | |
.then((res) => { | |
// ... | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Promise.resolve(skipPosting) | |
.then((res) => { | |
if ( res === 'skipPosting' ) { | |
throw new Error('skipPosting'); | |
} | |
}) | |
.then(() => { | |
const fromTs = ...; | |
let countOfQuestions = ...; | |
queryQuestions.get().then((querySnapshot) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const installUrl = `https://slack.com/oauth/v2/authorize?\ | |
client_id=${process.env.SLACK_CLIENT_ID}&scope=${process.env.SLACK_SCOPES}`; | |
module.exports.save = async function (data) { | |
await saveDoc(data); | |
} | |
var saveDoc = async function(data) { | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"project_info": { | |
"project_number": "1234567890", | |
"firebase_url": "https://yourapp.firebaseio.com", | |
"project_id": "yourapp", | |
"storage_bucket": "yourapp.appspot.com" | |
}, | |
"client": [ | |
{ | |
"client_info": { |
NewerOlder