- Raspberry PI Zero 2W (any PI should work ok)
- nodemcu-32s
- USB OTG Cable, Power Supply, etc...
- Flash the OS into the SD card (32gb is plenty) (Config: Username, Wifi and SSH)
- Connect the i2c RTC module to the rpi
#!/bin/bash | |
# Get the size of /snapshots | |
SNAPSHOT_SIZE=$(du -hs /snapshots 2>/dev/null | awk '{print $1}') | |
SNAPSHOT_TOTAL=$(ls | grep *.jpg | wc -l 2>/dev/null) | |
echo "[snapshots]" | |
echo "size: $SNAPSHOT_SIZE" | |
echo "total: $SNAPSHOT_TOTAL" | |
# Get the available space on the root partition |
// Ardiono Date https://adafruit.github.io/RTClib/html/class_date_time.html#a50502a3a29409c6c2507638779df1a9d | |
let now = new Date(); | |
// correct time zone offset for generating iso string | |
now.setMinutes(now.getMinutes() - now.getTimezoneOffset()) | |
console.log(now.toISOString()); |
var fs = require('fs'); | |
// An object to store our data | |
var stat = { | |
cpu: { | |
user: 0, | |
nice: 0, | |
system: 0, | |
idle: 0, | |
iowait: 0, |
/* | |
Bare bones template engine | |
*/ | |
const hydrate = function(template, scope) { | |
if ( | |
template.constructor === String && | |
template.length && | |
scope.constructor === Object && | |
Object.keys(scope).length | |
) { |
export function getNodeVersion(): { major: number; minor: number; patch: number } { | |
const version = process.version.match(/(\d+)\.(\d+)\.(\d+)/); | |
const [major, minor, patch] = ensureArray(version) | |
.slice(1) | |
.map((match) => parseInt(match as string, 10)); | |
return { | |
major, | |
minor, | |
patch, | |
}; |
export default async function scheduler<T, K>( | |
maxconnections: number, | |
items: K[], | |
functor: (item: K) => Promise<T> | |
): Promise<Array<T | undefined>> { | |
const workers: Array<T | undefined> = []; | |
for await (const result of runTasks<T>(maxconnections, tasks(items, functor))) { | |
workers.push(result); | |
} | |
return workers; |
const playlistId = new RegExp(/(?:http|https|)(?::\/\/|)(?:www.|)(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{12,})[a-z0-9;:@#?&%=+\/\$_.-]*/) | |
const videoId = new RegExp(/(?:http|https|)(?::\/\/|)(?:www.|)(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[a-z0-9;:@#?&%=+\/\$_.-]*/) | |
const getYouTubeId = (youTubeUrl: string): string | undefined => { | |
const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/ | |
var match = youTubeUrl.match(regExp) | |
if (match && match[2].length == 11) { | |
return match[2] | |
} | |
return undefined |
yarn upgrade --latest