This file contains hidden or 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 map = new Map([[1, true], [2, true], [3, false], [4, false], [5, true]]); | |
const processedMap = Array.from(map.entries()) | |
.map(([key, value]) => [value, key]) | |
.reduce((acc, [key, value]) => acc.set(key, value + (acc.get(key) || 0)), new Map()); | |
console.log('---------- Original Map ----------'); | |
for (const [key, value] of map.entries()) { | |
console.log(`key: ${key}, value: ${value}`); | |
} |
This file contains hidden or 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
Setup RaspberryPi: | |
mkdir -p /etc/ppp/scripts | |
cat > /etc/ppp/scripts/ppplogin <<EOF | |
#!/bin/sh | |
# ppplogin - script to fire up pppd on login | |
# Disable other users to write to the tty. | |
mesg n |
This file contains hidden or 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
/* exported WebSocketUtils */ | |
(function(exports) { | |
'use strict'; | |
exports.WebSocketUtils = { | |
/** | |
* Mask every data element with the mask (WebSocket specific algorithm). | |
* @param {Array} mask Mask array. | |
* @param {Array} array Data array to mask. |
NewerOlder