View flattenDeep.js
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 flattenDeep = (arr) => Array.isArray(arr) | |
? arr.reduce( (a, b) => a.concat(flattenDeep(b)) , []) | |
: [arr] |
View dnsmasq
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
addresses=( | |
local.viaplay.se | |
local.viaplay.dk | |
local.viaplay.fi | |
local.viaplay.no | |
local.mtg-api.com | |
) | |
for i in "${addresses[@]}" | |
do |
View water level part three.c
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
void loop() { | |
getWaterLevel(); | |
checkWaterLevel(); | |
delay(DELAY_IN_SECONDS * 1000); | |
} | |
int getWaterLevel() { | |
waterLevel = analogRead(waterLevelPin); | |
return waterLevel; | |
} |
View water level part two.c
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
void setup() { | |
Particle.variable(“waterLevel”, waterLevel); | |
Particle.function(“sendSms”, sendSms); | |
pinMode(waterLevelPin, INPUT); | |
delay(1000); | |
} |
View water level part one.c
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
int sendSms(String command); | |
const int DELAY_IN_SECONDS = 10*60; // 10 minutes | |
bool isMessageSent = false; | |
int waterThreshold = 2880; | |
int waterLevelPin = A1; | |
int waterLevel = 0; |
View twilio webhook output
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
$ particle webhook create twilio-hook.json | |
Using settings from the file twilio-hook.json | |
Sending webhook request { uri: ‘/v1/webhooks’, | |
method: ‘POST’, | |
json: | |
{ event: ‘twilio’, | |
url: ‘https://api.twilio.com/2010-04-01/Accounts//Messages', | |
deviceid: undefined, |
View twilio-webhook.js
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
{ | |
“eventName”: “twilio”, | |
“url”: “https://api.twilio.com/2010-04-01/Accounts//Messages", | |
“requestType”: “POST”, | |
“auth”: { | |
“username”: “”, | |
“password”: “” | |
}, | |
“form”: { | |
“From” : “”, |
View environment-property-dockerfile.yml
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
webapp: | |
envronment: | |
NODE_ENV: development | |
JWT_SECRET: my-secret | |
webapp: | |
envronment: | |
- NODE_ENV=development | |
- JWT_SECRET=my-secret | |
View conatiner_name-property-dockerfile.yml
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
webapp: | |
conatiner_name: webfront-eu-west |
View volumes_from-property-dockerfile.yml
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
webapp: | |
ports: | |
- "80" | |
volumes_from: | |
- "file_server" | |
file_server: | |
image: ubuntu |
NewerOlder