Skip to content

Instantly share code, notes, and snippets.

View nippe's full-sized avatar
:octocat:
Cruzin'

Niklas Nihlén nippe

:octocat:
Cruzin'
View GitHub Profile
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;
void setup() {
Particle.variable(“waterLevel”, waterLevel);
Particle.function(“sendSms”, sendSms);
pinMode(waterLevelPin, INPUT);
delay(1000);
}
void loop() {
getWaterLevel();
checkWaterLevel();
delay(DELAY_IN_SECONDS * 1000);
}
int getWaterLevel() {
waterLevel = analogRead(waterLevelPin);
return waterLevel;
}
@nippe
nippe / dnsmasq
Last active September 22, 2016 16:36
addresses=(
local.viaplay.se
local.viaplay.dk
local.viaplay.fi
local.viaplay.no
local.mtg-api.com
)
for i in "${addresses[@]}"
do
@nippe
nippe / flattenDeep.js
Last active January 29, 2020 12:03
Lodash Native Helpers
const flattenDeep = (arr) => Array.isArray(arr)
? arr.reduce( (a, b) => a.concat(flattenDeep(b)) , [])
: [arr]
import { checkMX } from './mx'
import { checkSMTP } from './smtp'
import { Result } from './types'
const DEFAULT_RESULT = {
reachable: false,
mx: { valid: false },
smtp: { valid: false },
}