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
from bs4 import BeautifulSoup | |
from yaml import load, dump | |
html_doc = open('raw.html') | |
soup = BeautifulSoup(html_doc, 'html.parser') | |
teamMembers = (soup.find_all(class_="t-member")) | |
for member in teamMembers: |
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 geckoboard, datetime, bme680 | |
# Set up Pimroni BME680 sensors | |
# https://github.com/pimoroni/bme680-python/blob/master/examples/read-all.py | |
sensor = bme680.BME680() | |
sensor.set_humidity_oversample(bme680.OS_2X) | |
sensor.set_pressure_oversample(bme680.OS_4X) | |
sensor.set_temperature_oversample(bme680.OS_8X) |
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
on run argv | |
# Set variables | |
set chrome to "Google Chrome" | |
set zoom to "zoom.us" | |
set wait to 0.5 | |
set initialWindow to "Zoom - Pro Account" # If you're not using Zoom Pro you will need to change this | |
tell application chrome | |
if it is running then |
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
function lunchReminder() { | |
var curHour = new Date().getHours(); | |
if (curHour > 17 || curHour < 9) { | |
Logger.log("Outside work hours stopping"); | |
return | |
} | |
var completedValues = sheet.getRange(startRow,1,rowRange,1).getValues(); | |
var slackNames = sheet.getRange(startRow,2,rowRange,1).getValues(); |
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
function updateUnattendingRows() { | |
var attendingValues = sheet.getRange(startRow,4,rowRange,1).getValues(); | |
var color = "lightgrey" | |
for (var i = 0; i < attendingValues.length; i++) { | |
var rr = sheet.getRange("A"+(i+startRow)+":I"+(i+startRow)) | |
if(attendingValues[i][0] === false && rr.getBackground() != color) { | |
rr.setBackground(color); | |
} else { |
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
function closeLunch() { | |
var triggers = ScriptApp.getProjectTriggers(); | |
updateUnattendingRows(); | |
triggerSlackRequest("main", "Lunch orders are now closed"); | |
triggerSlackRequest(completedOrdersUser, "Lunch is now officially closed"); | |
for (var i = 0; i < triggers.length; i++) { | |
if (triggers[i].getHandlerFunction() == "lunchReminder" || triggers[i].getHandlerFunction() == "notifyOrdersAppearCompleted") { | |
ScriptApp.deleteTrigger(triggers[i]); |
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
function notifyOrdersAppearCompleted() { | |
var curHour = new Date().getHours(); | |
var notifiedCell = sheet.getRange("F3").getValues()[0][0]; | |
if (notifiedCell == true) { | |
return | |
} | |
if (curHour > 17 || curHour < 9) { | |
Logger.log("Outside work hours stopping"); |
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
function triggerSlackRequest(channel, msg) { | |
var slackWebhook = "YOUR PERSONAL SLACK TOKENIZED URL"; | |
var payload = { "channel": channel, "text": msg, "link_names": 1, "username": "lunchbot", "icon_emoji": ":hamburger:" }; | |
var options = { "method": "post", "contentType": "application/json", "muteHttpExceptions": true, "payload": JSON.stringify(payload) }; | |
Logger.log(UrlFetchApp.fetch(slackWebhook, options)); | |
} |
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
function createTimeTriggers(hour) { | |
ScriptApp.newTrigger('lunchReminder') | |
.timeBased() | |
.everyHours(hour) | |
.create(); | |
ScriptApp.newTrigger('notifyOrdersAppearCompleted') | |
.timeBased() | |
.everyMinutes(5) | |
.create(); |
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
function openLunch() { | |
var restaurant = sheet.getRange("B1").getValues()[0][0]; | |
var deadline = sheet.getRange("B2").getValues()[0][0]; | |
triggerSlackRequest("main", "@london: FRIDAY LUNCH: *"+ restaurant +"*. Please order by *"+ deadline +"*. Cheers.\n"+ sheetURL); | |
createTimeTriggers(2); | |
} |
NewerOlder