Collection of various node.js scripts
JavaScript Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
test
.gitignore
LICENSE.md
README.md
bodhi-scripts.js
package.json
run-tests.sh

README.md

Just some scripts I use regularly.

Install

There are two ways to install the bodhi-scripts. The first is for the stand alone tools the second for the library.

    npm install -g bodhi-scripts
    npm install bodhi-scripts

Run unit tests (Linux)

    cd bodhi-scripts
    ./run-tests.sh

bodhi-authenticator.js

Implementation of the Google authenticator. Time base one-time token from 80-bit secret. The secret must be base32 encoded.

bodhi-args.js

Super simple cli arguments.

Supports flags like: -m -O2 --long --no-error Every detected flag is set true:

    var arguments = require('bodhi-scripts').args.initialize();
    arguments['m'] === true
    arguments['no-error'] === true

Supports parameters like: -x 123 --message "Hello World!" Every detected parameter is set to its value:

    var arguments = require('bodhi-scripts')
        .args
        .setValueFlag('x', '')
        .setValueFlag('message', '')
        .initialize();
    arguments['x'] === '123'
    arguments['message'] === 'Hello World!'

Unused arguments are added to the 'unbound' array.

bodhi-passwd

Simple user database in a JSON file.

bodhi-macgen

Generate random MAC addresses.

bodhi-logger.js

There are four log levels as strings: 'debug', 'info', 'warning' and 'error'. For disabling logging use: 'none'

Usage

var logger = require('bodhi-scripts').logger;
var options = {
    filePath: '/tmp',           // where to save log files
    filename: 'bodhi-logger',   // name of the log
    fileSeparator: ';',
    fileExtension: 'log',       // file extension of the log file
    fileLogLevel: 'warning',    // minumum log level for log files, use 'none' for no logging
    fileColor: false,

    consoleSeparator: '\t',
    consoleLogLevel: 'debug',   // minimum log level for console
    consoleTimestamp: true,     // enable time stamp for console logs
    consoleColor: true         // enable colors in console log
};
logger.init(options);

logger.logDebug('This is a debug message.');
logger.logInfo('This is some information.')
logger.logWarning('This is a warning message.')
logger.logError('This is really bad!');

bodhi-testsuite

Simple unit test framework.

bodhi-file-server

Simple file server to instantly share folders.

bodhi-jsonrpc-client/service.js

Execute JSON remote procedure calls and implement JSON RPC services.