node command.js --cmd=PWR01
Power On
node command.js --cmd=PWR00
Power Off
node command.js --cmd=MVL010
Master volume = 10
node command.js --cmd=MVL000
Master volume = 0\
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 cluster = require("cluster"); | |
const http = require("http"); | |
const os = require("os"); | |
const net = require("net"); | |
const ip = require('ip'); | |
// create seed | |
const seed = (Math.random() * 0xffffffff) | 0; | |
/** |
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 net = require("net"); | |
const ip = require('ip'); | |
const os = require("os"); | |
const cluster = require("cluster"); | |
module.exports = function (seed) { | |
/** | |
* Hash IP |
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 dgram = require("dgram"); | |
var client = dgram.createSocket("udp4"); | |
client.on("message", function(data, remote){ | |
let str = data.toString("utf8"); | |
let obj = JSON.parse(str); |
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 os = require("os"); | |
const fs = require("fs"); | |
const path = require("path"); | |
const express = require('express'); | |
const multer = require('multer'); | |
const bodyParser = require('body-parser'); | |
// build/normalize paths | |
const src = path.resolve(os.tmpdir(), "uploads"); |
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 events = require("events").EventEmitter; | |
/* | |
Added complex matches by Shimon Doodkin 2012 | |
Developed by Elijah Rutschman 2009 - http://elijahr.blogspot.com/2009/03/javascript-cron.html | |
*/ | |
/* | |
a typical cron entry has either wildcards (*) or an integer: |
- Quick & dirty tar.gz/.tgz verification
- add extra header filed
- sub header contains:
- Author information (email & name)
- Signature from server (public + private key)
lib coming soon...
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
var makeCRCTable = function(){ | |
var c; | |
var crcTable = []; | |
for(var n =0; n < 256; n++){ | |
c = n; | |
for(var k =0; k < 8; k++){ | |
c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); | |
} | |
crcTable[n] = c; | |
} |
This is a example of a very lightweight, stream based, node.js logger. It creates a "record" object for each log call, and pipe it throught the spicified streams. In the streams its possible to modifie the record, format the message, and many more.
Bunyan, there is no one responding on issues, Winstons is way to big and have unecesseray dependencies.
I wanted a lightweight, easy to use, expandable, stream based, logging utily with zero dependencies.
You can all merge this down into a single file. You bascily need class.logger.js
& levels.js
which can simple merged into a single file.
The other files (demo.js
, formatter.js
) are for demonstration & formatting and not needed for the functionality.
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 { Transform } = require("stream"); | |
module.exports = () => { | |
let encode = new Transform({ | |
transform(chunk, encoding, cb) { | |
console.log("[encode]", chunk); | |
cb(null, chunk); |
OlderNewer