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
version: '3.8' | |
services: | |
postgres: | |
image: postgres:15.5-alpine | |
container_name: postgres-zt | |
volumes: | |
- ./volumes/postgres:/var/lib/postgresql/data | |
environment: | |
POSTGRES_DB: ztnet |
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
/** | |
* Interpolates a string template with values from an object or array. | |
* | |
* @param {string} template - The string containing placeholders to be interpolated. | |
* @param {Object|Array} values - An object or array containing values to replace the placeholders. | |
* @param {string|boolean} [fallback=""] - Value to use when a placeholder's corresponding key is not found. | |
* If set to `true`, the placeholder itself is used as the fallback. | |
* | |
* @returns {string} - The interpolated string. | |
* |
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
async function deriveKey(plaintextKey) { | |
const baseKey = await window.crypto.subtle.importKey("raw", new TextEncoder().encode(plaintextKey), "PBKDF2", false, ["deriveKey"]); | |
return window.crypto.subtle.deriveKey( | |
{ | |
name: "PBKDF2", | |
salt: new TextEncoder().encode("some-salt"), | |
iterations: 10000, | |
hash: "SHA-256" | |
}, | |
baseKey, |
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
Instructions: | |
1. Install 'arp_monitor.sh' file on DHCP server and setup cronjob. | |
2. Copy the flow from flow.json and import into Nodered. | |
The '.function-node' Javascript files are provided for ease of reading. The code within these files is already in the flow. | |
Take note of the ARP debouncing. You may want to adjust the timings if you are getting false online/offline alerts, or it isn't quick enough for you. | |
Variabes are: |
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
{ | |
devices: { | |
bedroomLight: { | |
type: "switch" | |
}, | |
denLight: { | |
type: "dimmable" | |
}, | |
livingroomLight: { | |
type: "dimmable" |
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 fs = require('fs'); | |
const path = require('path'); | |
const { execSync } = require('child_process') | |
const baseDir = './'; | |
const videoFileTypes = ['mp4', 'mov', 'avi', 'wmv', 'mkv', 'flv', 'mpg', 'mpeg', '3gp', '3g2']; | |
const allFiles = fs.readdirSync(baseDir); | |
const videoFiles = []; |
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
#!/bin/bash | |
# Created by: Slyke | |
# Email: [email protected] | |
# Version: 3 | |
# Date: 2022-09-10 | |
# This script allows you to automatically install SSH keys from your github account, and optionally disable password authentication for sshd. | |
# Best to clone this script to your own github gist and curl it from there, instead of using mine. | |
# It is also better to dump this to a file locally and run it from there if placed in a cronjob. | |
# License: MIT |