open-index/open-npm huggingface dataset:
npm package: @mgxs/common
Description: MGXS LIbrary of common components
Author: Silvio Paganini
Latest version: 1.3.0

# MGXS Common library

- Creates Material-UI default theme
- Spritesheet Loader Component

more to come

## Install on another React project

```sh
npm add @mgxs/common @emotion/react @emotion/styled @mui/material
```

## Usage

### Theme

On your `index.tsx` file from your React project add

```ts
import { Theme } from "@mgxs/common";
import ReactDOM from "react-dom/client";
import { App } from "./components";

const root = ReactDOM.createRoot(
  document.getElementById("root") as HTMLElement
);

root.render(
  <Theme>
    <App />
  </Theme>
);
```

### Loader

```ts
import { Loader } from "@mgxs/common";

const Page = () => {
  return <Loader scale={2} />;
};
```
npm package: @mgxs/web3
Description: MGXS web3
Author: Silvio Paganini
Latest version: 1.3.1

# GNSS Web3

GNSS Ethereum Contracts ABIs

## Install 

```bash
npm add @mgxs/web3
```

## Usage

```ts
// ABIs
import {
  CONTRACT_MINT_ADDRESS,
  CONTRACT_REVEAL_ADDRESS,
  MINT,
  REVEAL,
} from "@mgxs/web3";

const CONTRACTS = {
  mint: {
    address: CONTRACT_MINT_ADDRESS,
    abi: MINT,
  },
  reveal: { address: CONTRACT_REVEAL_ADDRESS, abi: REVEAL },
};
```
npm package: @mgxxx/moui
Description: A react library developed with dumi
Latest version: 0.0.2

# moui

[![NPM version](https://img.shields.io/npm/v/moui.svg?style=flat)](https://npmjs.org/package/moui)
[![NPM downloads](http://img.shields.io/npm/dm/moui.svg?style=flat)](https://npmjs.org/package/moui)

A react library developed with dumi

## Usage

TODO

## Options

TODO

## Development

```bash
# install dependencies
$ pnpm install

# develop library by docs demo
$ pnpm start

# build library source code
$ pnpm run build

# build library source code in watch mode
$ pnpm run build:watch

# build docs
$ pnpm run docs:build

# check your project for potential problems
$ pnpm run doctor
```

## LICENSE

MIT
npm package: @mh-cbon/bonjour-publish
Description: Publish a service on bonjour
Author: mh-cbon
Latest version: 1.0.1

# bonjour-publish
Publish a service on bonjour

# Install

```
git clone https://github.com/mh-cbon/bonjour-publish.git
cd bonjour-publish
npm link . --local
bonjour-publish -H 127.0.0.1 -P 8088 -T rc "Title of the server"
...
ctrl+c to quit
```

# Command line

    bonjour-publish 1.0.0
    Publish a service on bonjour

    Usage

      bonjour-publish --host=127.0.0.1 --port=8088 --type=some  "Title of the server"

    Options

      Announcement (bonjour)
      --port | -P       Port which your server listens (8090)
      --type | -T       Type of interface provided by your server (http|smtp..)
      --host | -H       Host which your server listens (127.0.0.1)
      --txt             A JSON object to send as a TXT record.
      --v4 [interface]  If Host option is not provided, announce ipv4 address as host,
                        instead of your local bonjour hostname.
                        If interface (eth0, lo..) is provided,
                        only this interface will be announced.
      --v6 [interface]  If Host option is not provided, announce ipv6 address as host,
                        instead of your local bonjour hostname.
                        If interface (eth0, lo..) is provided,
                        only this interface will be announced.

      Socket setup (mdns)
      --multicast | -M  Use UDP multicasting
      --interface | -I  Explicitly specify a network interface. Defaults to all. (192.168.0.2)
      --udpport         Set the UDP port (5353)
      --udpip           Set the UDP IP (224.0.0.251)
      --ttl | -T        Set the multicast TTL (255)
      --loopback | -L   Receive your own packets
      --reuseAddr | -R  Set the reuseAddr on the socket (node >=0.11.13)
      --verbose | -v    Set verbosity. Defaults to * Pass in modules name to debug.

    Examples
      bonjour-publish -H 127.0.0.1 -P 8088 -T http "hello!"
      bonjour-publish -H 127.0.0.1 -P 8088 -T http "I love you,"
      bonjour-publish -L -H 127.0.0.1 -P 8088 -T http "Could you give me your name ?"
      bonjour-publish -L -R -P 8088 -T http "doors"
      bonjour-publish -L -R -M -I 192.168.0.2 -P 8088 -T http "doors"
      bonjour-publish --txt '{"password":123}' -P 8088 -T http "doors"

    Read more
      Service type must be one described at
      http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml

# read more

- https://github.com/watson/bonjour
- https://github.com/mafintosh/multicast-dns
- https://github.com/watson/bonjour-browser
- http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml
npm package: @mh-cbon/c-aghfabsowecwn
Description: Singleton server for aghfabsowecwn
Author: mh-cbon
Latest version: 1.0.2

# c-aghfabsowecwn

Singleton server for `aghfabsowecwn`, so `UAC` query occurs only once per node process.


# Install

```sh
npm i @mh-cbon/c-aghfabsowecwn --save
```

# Usage

It follows the exact same signature as [aghfabsowecwn](https://github.com/mh-cbon/aghfabsowecwn).

The only difference being that you can
require it as many times as you need within the same node process,
only one server will be spawned,
thus only one `UAC` query will appear for the end user.
npm package: @mh-cbon/c-yasudo
Description: Cached yasudo
Author: mh-cbon
Latest version: 1.0.2

# c-yasudo

Cached yasudo

# Install

```sh
npm @mh-cbon/c-yasudo --save
```

# Usage

Set sudo password given a pre defined env variable.

```js
// by default it will use process.env['yasudo']
var spawn = require('@mh-cbon/c-yasudo');
// but you can configure it
spawn.setVariable('THE_VARIABLE')
// password will now be looked into process.env['THE_VARIABLE']
```
npm package: @mh-cbon/catf
Description: just cat
Author: mh-cbon
Latest version: 1.0.2

# cat

Just cat. Cat files to stdout.

# Install

```
npm i @mh-cbon/catf -g
```

# Usage

```
catf [file] [file]....
echo "something" | catf
echo "something" | catf [file]
```

# Why ?

cross platform cat, sudo/elevate-able command.
npm package: @mh-cbon/challenger
Description: Challenge sudo over the streams
Author: mh-cbon
Latest version: 1.0.1

# challenger
Challenge sudo over the streams

# Install

```sh
npm i @mh-cbon/challenger --save
```

# Usage

```js

var challenger = require('./index.js')(process.env['SUDOPWD']);

var cmd = 'echo "token" 1>&2 && sudo -S -k echo "my token" 1>&2 && sudo -S -k echo "my token22" 1>&2';

var child = challenger.spawn('sh', ['-c', cmd], {stdio:'pipe'});

child.stderr.pipe(process.stderr);
child.stdout.pipe(process.stdout);

child.on('exit', function () {
  console.log('exit')
})
child.on('close', function () {
  console.log('close')
})

```

It resolves the sudo challenge given the password provided in `env['SUDOPWD']`.

If the password is incorrect, prompt user for a new password until the challenge is solved, or dies.

When the new password is correct, save it in memory for later use.

Also cleans up stderr of any sudo challenge output.

#### alternate usage

To get the complete about of the child_process you may proceed so,

```js
var spawn = require('child_process').spawn;

var challenger = require('./index.js')(process.env['SUDOPWD']);

var cmd = 'echo "token" 1>&2 && sudo -S -k echo "my token" 1>&2 && sudo -S -k echo "my token22" 1>&2';

var child = spawn('sh', ['-c', cmd], {stdio:'pipe'});

var cleanStderr = challenger(child);

//cleanStderr.pipe(process.stderr);
child.stderr.pipe(process.stderr);

child.stdout.pipe(process.stdout);

child.on('exit', function () {
  console.log('exit')
})
child.on('close', function () {
  console.log('close')
})

```

# Notes

- All sudo commands must use `-S`, otherwise sudo writes directly onto the terminal device, which this module does not listen.
- the child process must pipe both `stderr` and `stdin`
npm package: @mh-cbon/cors-proxy
Description: A proxy to handle CORS on non-compatible CORS websites
Author: mh-cbon
Latest version: 1.0.1

# cors-proxy

A proxy to handle CORS on non-compatible CORS websites

## notes

It s early lifetime of this module, if you find an issue, report it.

## Features

- Preflighted requests
- X-Forward headers
- SSL

# Usage

```
cors-proxy 1.0.0
  A proxy to handle CORS on non-compatible CORS websites

Usage
  cors-proxy [opts]

Options
  -B|--bind [proto://host:port]     Proto, host, port to bind.
                                    Defaults to http://127.0.0.1:8000/
  -s|--source [proto://host:port]   Address to proxify
  -c|--credentials                  With credentials support
  -e|--exposed [headers exposed]    List of exposed headers, comma separated.
  -H|--headers [headers list]       List of allowed headers, comma separated.
  -m|--methods [methods list]       List of allowed methods, comma separated.
  -M|--maxage [number]              Max-Age value for pre-flighted requests
  -o|--origin [proto://host:port/]  Which origin to allow,
                                    if not specified, returns request host.
  -q|--quick                        Quick setup,
                                    [GET,POST] + Credentials + request host.
  -v|--verbose [modules]            Verbose
  -h|--help                         Show help

Examples
  cors-proxy -v
  cors-proxy -v -s http://127.0.0.1:8080/
  cors-proxy -v -s http://127.0.0.1:8080/ -c
  cors-proxy -v -s http://127.0.0.1:8080/ -o http://127.0.0.1:8081/ -c
  cors-proxy -v -s http://127.0.0.1:8080/ -o http://127.0.0.1:8081/ -m GET,POST -c
  cors-proxy -v -s http://127.0.0.1:8080/ -o http://127.0.0.1:8081/ -m GET,POST -H X-what,X-ever -c
  cors-proxy -v -q -s http://127.0.0.1:8080/
```

## todos

- Write tests for SSL handling on both proxy / proxified resources
- real life testings

## Read more

- https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
- http://stackoverflow.com/questions/19084340/real-life-usage-of-the-x-forwarded-host-header
- http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/x-forwarded-headers.html
- https://en.wikipedia.org/wiki/X-Forwarded-For
- https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Common_non-standard_request_fields
- https://nodejs.org/api/http.html

## Credits

Many inspiration provided by [drowzy's work](https://github.com/drowzy/pico-proxy)
npm package: @mh-cbon/cpkaaot
Description: child_process keep alive and other things
Author: mh-cbon
Latest version: 1.0.5

# cpkaaot - child_process keep alive and other things

Keep alive a process, watch port activity to spawn/kill the child process, redirect stdout / stderr.

# install

```sh
npm i @mh-cbon/cpkaaot -g
```

# usage

```sh
cpkaaot [options] -- [command line]

Required options
  --retry           How many time should cpkaaot tries to respawn the process.
  --retrytimespan   Timespan (minute) the process must not die more than
                    --retry times before it is considered as incorrect.

Optional options
  --stdout          Where to redirect child process stdout (path, url, tcp).
  --stderr          Where to redirect child process stderr (path, url, tcp).
  --watchaddress    Port to watch for activity to spawn the process.
  --watchinactvity  Inactive duration (minute) on the port after what the process is killed.
  --watchforward    Forward connect sockets to this address.
```

# Example

Keep alive a process, but stop to re spawn it if it dies more 3 times a minute.

`cpkaaot --retry 3 --retrytimespan 180000 -- [bin args]`

Redirect stdout to a file

`cpkaaot --retry 3 --retrytimespan 180000 --stdout /path/to/file -- [bin args]`

Watch activity on port `8000`,
starts the process when a socket connects,
stop the process after 3 minutes inactivity,
forward sockets to `localhost:8001`.

`cpkaaot --retry 3 --retrytimespan 180000 --watchaddress 8000 --watchinactvity 180000 --watchforward 8001 -- [bin args]`

# more examples

```
cpkaaot --retry 3 --retrytimespan 180000 --stdout http://path:port/url/ -- [bin args]
cpkaaot --retry 3 --retrytimespan 180000 --stdout tcp://ip:port -- [bin args]
cpkaaot --retry 3 --retrytimespan 180000 --stderr file://path/ -- [bin args]

```

# Tests

To run the tests

```sh
DEBUG=@mh-cbon/cpkaaot mocha
```
npm package: @mh-cbon/dscacheutil
Description: dscacheutil to json
Author: mh-cbon
Latest version: 1.0.5

# dscacheutil
Provides dscacheutil response parsing to JSON.

# install

```sh
npm i @mh-cbon/dscacheutil --save
```

# usage

```js
  var dscacheutil = require('@mh-cbon/dscacheutil')

  dscacheutil({q: 'host'}, function (err, code, data) {
    process.exitCode = parseInt(code);
    if (code!==0) err && console.error(err);
    else data && console.log(JSON.stringify(data, null, 2));
  });
```

# as a binary

```sh
npm i @mh-cbon/dscacheutil -g
jdscacheutil -q host
jdscacheutil -q rpc
jdscacheutil -q user
jdscacheutil -q group
```

see [dscacheutil](http://ss64.com/osx/dscacheutil.html)
npm package: @mh-cbon/dscl-users
Description: Macos helper to help manage user and group
Author: mh-cbon
Latest version: 1.0.1

# dscl-users

Macos helper to help manage user and group.

# install

```sh
npm i @mh-cbon/dscl-users --save
```

# usage

```js
var dscl  = require('@mh-cbon/dscl-users')


// work with groups
dscl.groups(function (err, groups) {
  err && console.error(err);
  !err && console.log(groups);
})
dscl.groupsDetails(function (err, items) {
  err && console.error(err);
  !err && console.log(items);
})
dscl.listGids(function (err, gids) {
  err && console.error(err);
  !err && console.log(gids);
})
dscl.newGid(function (err, gid) {
  err && console.error(err);
  !err && console.log(gid);
})
dscl.getGroupId('the group name', function (err, gid) {
  err && console.error(err);
  !err && console.log(gid);
})
dscl.groupDetails('the group name', function (err, details) {
  err && console.error(err);
  !err && console.log(details);
})
dscl.groupExists('the group name', function (err, exists) {
  err && console.error(err);
  !err && console.log("exists %s", exists);
})
dscl.groupAdd('the group name', {}, function (err) {
  err && console.error(err);
})
dscl.groupAddUser('the group name', 'the user name', {}, function (err) {
  err && console.error(err);
})
dscl.groupRemUser('the group name', 'the user name', {}, function (err) {
  err && console.error(err);
})
dscl.groupRemove('the group name', {}, function (err) {
  err && console.error(err);
})
dscl.getGroupName(502, {}, function (err, name) {
  err && console.error(err);
  !err && console.log(name);
})


// work with users
dscl.users(function (err, users) {
  err && console.error(err);
  !err && console.log(users);
})
dscl.listUids(function (err, uids) {
  err && console.error(err);
  !err && console.log(uids);
})
dscl.newUid(function (err, uid) { // uid > 500
  err && console.error(err);
  !err && console.log(uid);
})
dscl.newSystemUid(function (err, uid) { // uid < 500
  err && console.error(err);
  !err && console.log(uid);
})
dscl.userDetails('the user name', function (err, details) {
  err && console.error(err);
  !err && console.log(details);
})
dscl.userExists('the user name', function (err, exists) {
  err && console.error(err);
  !err && console.log("exists %s", exists);
})
dscl.getGroupsOfUser('the user name', function (err, groups) {
  err && console.error(err);
  !err && console.log(groups);
})
dscl.userAdd('the user name', {
  uid: 11,
  gid: 12,
  hidden: false,
  guest: false,
  home_dir: true, // can be a string to the path, will create and chown it.
  full_name: 'the full name',
  password: 'the password',
  shell: '/bin/bash'
}, function (err) {
  err && console.error(err);
});
dscl.userRemove('the user name', {
  remove: false, // delete home directory
}, function (err) {
  err && console.error(err);
});
dscl.remUserFromGroups('the user name', function (err) {
  err && console.error(err);
});
```

# test

- get vagrant from the official website
- run `sh mocha.sh`

# debug

Use `DEBUG=@mh-cbon/dscl-users` to get short debug output.

Use `DEBUG=@mh-cbon/dscl-users,@mh-cbon/dscl-users:full` to get a more complete output.
npm package: @mh-cbon/getent
Description: getent to json
Author: mh-cbon
Latest version: 1.0.2

# getent

Provides `getent` response parsing to JSON.

# install

```sh
  npm i @mh-cbon/getent --save
```

# usage

```js
  var jgetent = require('@mh-cbon/getent')

  var opts = {
    'idn': false,
    services: ['xxx']
  };
  var db = 'ahosts';
  var keys = ['amd.com'];

  jgetent(opts, db, keys, function (code, err, data) {
    process.exitCode = parseInt(code);
    if (code!==0) err && console.error(err);
    else data && console.log(JSON.stringify(data, null, 2));
  });
```

# as a binary

```sh
  npm i @mh-cbon/getent -g
  jgetent ahosts
  jgetent rpc
  jgetent passwd
```

see [man getent](http://man7.org/linux/man-pages/man1/getent.1.html)
npm package: @mh-cbon/has-chkconfig
Description: Tells if a system runs chkconfig sysvinit helper
Author: mh-cbon
Latest version: 1.0.4

# has-chkconfig

Tells if a system runs `chkconfig`

# install

```sh
npm i @mh-cbon/has-chkconfig --save
```

# Usage

```js
require('@mh-cbon/has-chkconfig')(function (err, path){
  err && console.error("This system does not run chkconfig")
  !err && console.log("This system provides chkconfig at %j", path)
}))
```

# Read more

- https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s2-services-chkconfig.html
- http://linux.die.net/man/8/chkconfig
npm package: @mh-cbon/has-launchd
Description: tells if a system runs macos launchd service manager
Author: mh-cbon
Latest version: 1.0.2

# has-launchd

Tells if macos [launchd](http://nathangrigg.net/2012/07/schedule-jobs-using-launchd/) is available.

## Usage

```js
require('@mh-cbon/has-launchd')(function (err, launchdPath) {
  console.log("This system runs launchd : %s", err?"no":"yes");
  launchdPath && console.log("Found launchd at path : %s", launchdPath)
})
```

## Testing

#### mac

To run the __mac__ tests on a fedora-like box,

- download and install [vagrant](https://www.vagrantup.com/)
- execute `npm run test-mac`
- wait, a looooooonnnnggggg time. Mac images are very big....


#### linux
To run the __linux__ tests on a fedora-like box,

- download and install `vagrant`
- execute `npm run test-not-mac`

or just

- download and install `mocha`
- `mocha test/not-mac.js`

## TODOS

- add tests for macos/lion
- ~~add tests for macos/maverick~~
- ~~add tests for macos/yosemite~~
- add tests for macos/elcapitan
npm package: @mh-cbon/has-sc
Description: Tells if windows SC is available
Author: mh-cbon
Latest version: 1.0.4

# has-sc

Tells if windows [sc](https://technet.microsoft.com/en-us/library/bb490995.aspx) is vailable.

## Usage

```js
require('@mh-cbon/has-sc')(function (err, scPath) {
  console.log("This system runs sc : %s", err?"no":"yes");
  scPath && console.log("Found sc at path : %s", scPath)
})
```

## Testing

#### windows

To run the __windows__ tests on a fedora-like box,

- download and install [vagrant from their website](https://www.vagrantup.com/downloads.html), do not use distrib package. WinRM is somehow broken at that day.
- install [winrm plugin](https://github.com/criteo/vagrant-winrm): `vagrant plugin install vagrant-winrm`
- execute `npm run test-windows`
- wait, a looooooonnnnggggg time. Windows images are very big....


#### linux
To run the __linux__ tests on a fedora-like box,

- download and install `vagrant`
- execute `npm run test-not-windows`

or just

- download and install `mocha`
- `mocha test/not-windows.js`

## TODOS

- add tests for win7
- add tests for win8
- add tests for win10
- add tests for win2008 server
- add tests for vista ?

The problem is mostly about finding / building vagrant boxes of those OS.

If you run some of those systems, i d be happy if you run the tests and communicate the results.

## Notes

A static build version of `wget` is included in this repository for testing purposes on windows.

The reasons are :

- power shell is not a reliable tool to do so because it provides such thing only from version 3.0
- windows does not provide alternative to power shell capabilities
- i was lazy to write a statically built C component
- it exists.
npm package: @mh-cbon/has-systemd
Description: tells if a system runs systemd service manager
Author: mh-cbon
Latest version: 1.0.1

# has-systemd

Tells if linux [systemd](https://en.wikipedia.org/wiki/Systemd) is available.

## Usage

```js
require('@mh-cbon/has-systemd')(function (err, systemCtlPath) {
  console.log("This system runs systemd : %s", err?"no":"yes");
  systemCtlPath && console.log("Found systemdctl at path : %s", systemCtlPath)
})
```

## Testing

#### systemd friendly

To run the __systemd friendly__ tests on a fedora-like box,

- download and install [vagrant](https://www.vagrantup.com/)
- execute `npm run test-fedora`


#### systemd non friendly
To run the __systemd non friendly__ tests on a fedora-like box,

- download and install `vagrant`
- execute `npm run test-not-fedora`

or just

- download and install `mocha`
- `mocha test/not-fedora.js`

## Notes

More tests are needed on more boxes, have a look at this,
- http://unix.stackexchange.com/questions/18209/detect-init-system-using-the-shell
- http://unix.stackexchange.com/questions/196166/how-to-find-out-if-a-system-uses-sysv-upstart-or-systemd-initsystem
npm package: @mh-cbon/has-sysv
Description: Tells if sysv init system is available on the system
Author: mh-cbon
Latest version: 1.0.1

# has-sysv

Tells if the system is running sysv init system.

# Install

```sh
npm i @mh-cbon/has-sysv
```

# Usage

```js
require('@mh-cbon/has-sysv')(function (err) {
  if (err) return console.error('this system does not run sysv');
  console.log('This system seems to run sysv');
})
```
npm package: @mh-cbon/has-upstart
Description: tells if a system runs upstart service manager
Author: mh-cbon
Latest version: 1.0.3

# has-upstart

Tells if linux [upstart](https://en.wikipedia.org/wiki/Upstart) is available.

## Usage

```js
require('@mh-cbon/has-upstart')(function (err, initctlPath) {
  console.log("This system runs upstart : %s", err?"no":"yes");
  systemCtlPath && console.log("Found initctl at path : %s", initctlPath)
})
```

## Testing

#### upstart friendly

To run the __upstart friendly__ tests on a fedora-like box,

- download and install [vagrant](https://www.vagrantup.com/)
- execute `npm run test-ubuntu`


#### upstart non friendly
To run the __upstart non friendly__ tests on a fedora-like box,

- download and install `vagrant`
- execute `npm run test-not-ubuntu`

or just

- download and install `mocha`
- `mocha test/not-ubuntu.js`

## Notes

More tests are needed on more boxes, have a look at this,
- http://unix.stackexchange.com/questions/18209/detect-init-system-using-the-shell
- http://unix.stackexchange.com/questions/196166/how-to-find-out-if-a-system-uses-sysv-upstart-or-systemd-initsystem
npm package: @mh-cbon/is-consenting
Description: Tells if consent.exe (uac) is running.
Author: mh-cbon
Latest version: 1.0.1

# is-consenting

Tells if `consent.exe` (uac) is running.

# Install

```
  npm i @mh-cbon/is-consenting --save
```

# Usage

### As a simple callback

```js
var isConsenting  = require('@mh-cbon/is-consenting');

isConsenting.now(function (err, p) {
  if (err) throw err;
  console.log("UAC is running now: %s", !!p);
  p && console.log("%j", p);
})
```

### As an event stream

Every time a `node` process enters / leaves, an event is emitted

```js
var isConsenting  = require('@mh-cbon/is-consenting');

var s = isConsenting.esPsList(/^node/)
.on('enter', function (p) {
  console.log('a node process appeared')
  console.log("%j", p);
}).on('leave', function (p) {
  console.log('a node process left')
  console.log("%j", p);
})

var c = require('child_process').spawn('node')
c.on('close', function () {
  s.once('leave', s.close.bind(s))
})
setTimeout(function () {
  c.kill();
}, 500)

```

Pass `true` as a second argument, to ignore existing process and catch only new ones,

```js
var s = isConsenting.esPsList(/^node/, true)
.on('enter', function (p) {
  console.log('a node process appeared')
  console.log("%j", p);
})
.on('leave', function (p) {
  console.log('a node process left')
  console.log("%j", p);
})
.on('end', function (p) {
  console.log('end')
})
.resume()

var c = require('child_process')
.spawn('node')
.on('close', function () {
  s.once('leave', s.close.bind(s))
})
setTimeout(function () {
  c.kill();
}, 500)
```

### Close

As an event-stream, it is an infinite stream, thus, you are required to call
the `close` method to free any pending operations.

`close` method will `end` the stream.
npm package: @mh-cbon/make-that-ssl-cert
Description: node binary to generate an SSL certificate
Author: mh-cbon
Latest version: 1.0.1

# make-that-ssl-cert
node binary to generate an SSL certificate.

Tired of openssl ? Found it awfully boring to generate a stupid self signed certificate ?

You are at the right place !

With help of [node-forge](https://github.com/digitalbazaar/forge) generate dummy ssl keys to feed in your projects.

# Install

```
npm i mh-cbon/make-that-ssl-cert -g
```

# Usage

```
make-that-ssl-cert 1.0.0
  node binary to generate an SSL certificate

Usage
  make-that-ssl-cert

Options
  --verbose | -v   Enable verbosity pass in the module list to debug.

```

# Todos

- add -y option
- add inquirer support to generate less dumbass cert

# Read more

- https://github.com/digitalbazaar/forge
- https://github.com/digitalbazaar/forge/blob/master/tests/nodejs-create-cert.js
npm package: @mh-cbon/npm-pkg-dl
Description: Download a package like npm
Author: mh-cbon
Latest version: 1.0.6

# npm-pkg-dl

Download a package like npm and make it available into a temporary folder.

# Install

```sh
npm i @mh-cbon/npm-pkg-dl -g
```

# Usage

```sh
npm-dl <package source> <-d|--dir target-path> <-r|--registry https://registry.url/>

npm-dl [<@scope>/]<name>
npm-dl [<@scope>/]<name>@<tag>
npm-dl [<@scope>/]<name>@<version>
npm-dl [<@scope>/]<name>@<version range>
npm-dl <tarball file>
npm-dl <tarball url>
npm-dl <folder>
```

# Api

```js
var npmPkgDl = require('@mh-cbon/npm-pkg-dl');

npmPkgDl('package source', {
  dir: "target directory", // or null for a temp directory
  registry: "the registry url"
}, function (err, dirPath) {
  err && console.error(err);
  console.log(dirPath);
})

```

# Examples

```sh
$ npm-pkg-dl minimist@">0.0.5" -d some
some/package

$ npm-pkg-dl @mh-cbon/cors-proxy -d some
some/package

$ npm-pkg-dl @mh-cbon/npm-pkg-dl@stable -d some
some/package

$ npm-pkg-dl mh-cbon/cors-proxy -d some
some

$ npm-pkg-dl git://github.com/mh-cbon/cors-proxy.git -d some
some

$ npm-pkg-dl github:mh-cbon/cors-proxy -d some
some

$ npm-pkg-dl https://github.com/mh-cbon/cors-proxy/archive/v1.0.1.zip -d some
some/cors-proxy-1.0.1

$ npm-pkg-dl https://github.com/mh-cbon/cors-proxy/archive/v1.0.1.tar.gz -d some
some/cors-proxy-1.0.1

$ npm-pkg-dl https://registry.npmjs.org/@mh-cbon/aghfabsowecwn/-/aghfabsowecwn-2.0.0.tgz -d some
some/package
```

# Read more

- https://docs.npmjs.com/cli/install
npm package: @mh-cbon/nssm-prebuilt
Description: NSSM prebuilt binary downloader and installer
Author: mh-cbon
Latest version: 0.0.4

# nssm-prebuilt

Node package to download and install `nssm` on windows.

# Install

```sh
npm install @mh-cbon/nssm-prebuilt --save
```

# Usage

```js
var nssm = require('@mh-cbon/nssm-prebuilt')

console.log("nssm version %s availabe at path %s", nssm.version, nssm.path)
```

# Binary

This package also comes with a binary proxy to `nssm.exe` file.

```sh
$ npm install @mh-cbon/nssm-prebuilt -g
$ nssm --version
2.24
C:\some\path\to\nssm.exe
```

# Read more

- https://nssm.cc/
npm package: @mh-cbon/pkg-source-to-pkg-json
Description: Transforms a downloadable package source string into its package.json equivalent
Author: mh-cbon
Latest version: 1.0.2

# pkg-source-to-pkg-json

Transforms a downloadable package source string into its package.json equivalent.

# Install

```sh
npm i @mh-cbon/pkg-source-to-pkg-json -g
```

# Usage

```sh
npm-pkg-json <package source> <-d|--dir target-path> <-r|--registry https://registry.url/>

npm-pkg-json [<@scope>/]<name>
npm-pkg-json [<@scope>/]<name>@<tag>
npm-pkg-json [<@scope>/]<name>@<version>
npm-pkg-json [<@scope>/]<name>@<version range>
npm-pkg-json <tarball file>
npm-pkg-json <tarball url>
npm-pkg-json <folder>
```

# Api

```js
var smthignToPkg = require('./index.js')

smthignToPkg(argv._[0], {
  dir: argv.dir || argv.d || null,
  registry: argv.regisry || argv.r || null
}, function (err, json) {
  if (err) {
    console.error(err);
    process.exit(1)
  }
  console.log("%s", JSON.stringify(json, null, 2));
})


```

# Examples

```sh
$ npm-pkg-json minimist@">0.0.5" -d some
{
  // content of the package json file
}
```

# Read more

- https://github.com/mh-cbon/npm-pkg-dl
npm package: @mh-cbon/roster
Description: Create or delete system user accounts in OS X, Linux and Windows.
Author: Tomas Pollak
Latest version: 0.0.6

Roster
=====

Create or delete system user accounts in Mac, Linux and Windows.

## Installation

    npm install @mh-cbon/roster --save

## API

```js
var roster = require('@mh-cbon/roster');

roster.exists('username', function(exists) {
  console.log('User exists? ' + exists);
})

roster.create({ user: 'new_guy', full_name: 'The New Guy' }, function(err) {
  if (!err) console.log('Successfully created.')
})

roster.delete('bad_user', function(err) {
  if (!err) console.log('Successfully deleted.')
})

roster.get_groups('bad_user', function(err, groups) {
  err && console.error(err);
  groups && console.log(JSON.stringify(groups, null, 2))
})
```

## As a binary

    npm install @mh-cbon/roster -g

## Usage

```sh
@mh-cbon/roster 0.0.3

Usage: roster [command] [user] [opts]

Commands:

 roster exists [user] [opts]

 roster groups [user] [opts]

 roster create [user] [opts]
   --home|-h       Create the home directory
   --home_dir|-d   Specify the home directory path
   --full_name|-f  Set the user full name
   --user_id|-i    Set the user ID
   --group_id|-g   Set the group ID
   --shell|-s      Set the user shell
   --groups        List of additionals comma separated groups to subscribe
   --system        Linux only, create a system account (-r)
   --hidden        Macos only, create an hidden account
   --guest         Macos only, create a guest account

 roster delete [user] [opts]
   --remove|-r     Delete the home directory

Options:

   --json          Print results as JSON
```

## Tests

- install vagrant from the official website
- add vbguest plugin `vagrant plugin install vbguest`
- add wrmi plugin `vagrant plugin install wrmi`
- `sh mocha.sh`

## Credits

Written by Tomás Pollak. MIT licensed.
npm package: @mh-cbon/sc-simple-api
Description: Simple api for node to manage services via windows sc
Author: mh-cbon
Latest version: 1.0.16

# sc-simple-api

A simple API to manage windows services via SC / NSSM.

# Install

```sh
npm i @mh-cbon/sc-simple-api --save
```

# Usage

```js
var SimpleScApi = require('@mh-cbon/sc-simple-api')

var ssa = new SimpleScApi()

// sc queryEx type= service
ssa.list({type: "service"}, function (err, items) {
  console.log(items)
})

// sc qdescribe serviceId
ssa.qdescribe("serviceId", function (err, info) {
  console.log(info)
})

// sc qdescribe serviceId + sc queryEx
ssa.describe("serviceId", function (err, info) {
  console.log(info)
})

// sc config fake type= service
ssa.config('fake', {type: "service"}, function (err) {
  err && console.error(err);
})

// sc create failure type= share displayname= "My fake service" \
// binpath= "C:\\nodejsx64\\node.exe C:\\vagrant\\utils\\fake-service.js"
var service = {
  id: 'failure',
  type: 'share',
  displayname: 'My fake service',
  binpath: 'C:\\nodejsx64\\node.exe C:\\vagrant\\utils\\fake-service.js'
}
ssa.install(service, function (err) {
  err && console.error(err);
})

// nssm.exe serviceId C:\\nodejsx64\\node.exe C:\\vagrant\\utils\\fake-service.js
ssa.nssmInstall('serviceId', 'C:\\nodejsx64\\node.exe', 'C:\\vagrant\\utils\\fake-service.js', function (err) {
  err && console.error(err);
})

// sc start fake some= args
ssa.start('fake', ["some=", "args"], function (err) {
  err && console.error(err);
})

// sc stop fake + sc start fake some= args
ssa.restart('fake', ["some=", "args"], function (err) {
  err && console.error(err);
})

// sc stop fake
ssa.stop('fake', function (err) {
  err && console.error(err);
})

// sc delete fake
ssa.uninstall('fake', function (err) {
  err && console.error(err);
})
```

# Testing

To run the __windows__ tests on a fedora-like box,

- download and install [vagrant from their website](https://www.vagrantup.com/downloads.html), do not use distrib package. WinRM is somehow broken at that day.
- install [winrm plugin](https://github.com/criteo/vagrant-winrm): `vagrant plugin install vagrant-winrm`
- execute `npm run test-windows`
- wait, a looooooonnnnggggg time. Windows images are very big....

# Read more
- https://msdn.microsoft.com/en-us/library/windows/desktop/ms685996%28v=vs.85%29.aspx
- https://msdn.microsoft.com/fr-fr/library/windows/desktop/ee126211%28v=vs.85%29.aspx
- https://msdn.microsoft.com/en-us/library/windows/desktop/ms685138%28v=vs.85%29.aspx
- http://nssm.cc/commands
- https://technet.microsoft.com/en-us/library/cc742126.aspx

# notes

If you start to experience weirds behaviors, reboot your windows. As an example, see [this](http://stackoverflow.com/questions/20561990/how-to-solve-the-specified-service-has-been-marked-for-deletion-error)
npm package: @mh-cbon/sp-lsbish
Description: Stream parser for LSB init script headers
Author: mh-cbon
Latest version: 1.0.1

# sp-lsbish - stream-parser-lsb-init-script-headers

A node stream parser for LSB (Linux Standard Base) headers of an init script.

## Introduction

Init scripts can expose headers to provide informations about the service definition.

Those information starts with `### BEGIN INIT INFO` and ends with `### END INIT INFO `,
they are a set of key-value pairs and can have multi-lines value.

They usually looks likes this:

```sh
$ cat /etc/init.d/puppet
#! /bin/sh
### BEGIN INIT INFO
# Provides:          puppet
# Required-Start:    $network $named $remote_fs $syslog
# Required-Stop:     $network $named $remote_fs $syslog
# Should-Start:      puppetmaster apache2
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: puppet agent
# Description:       The puppet agent connects to a puppet master, requests a
#                    catalog of resources, and configures the local system.
### END INIT INFO                                                                                                                                          
start() {
...
}

...
```

# Install

```sh
npm i @mh-cbon/sp-lsbish --save
```

# Usage

`lsbish` is a function which takes no arguments
and returns an `object` stream
which expect a by line input.

```js
require('fs')
.createReadStream('/etc/init.d/x11-common')
.pipe(require('split')())
.pipe(require('@mh-cbon/sp-lsbish')())
.pipe(require('through2').obj(function (data, enc, cb) {
  console.log(data)
  cb(null, data);
}))
```

Which prints out

```js
{ id: 'Provides', value: 'x11-common' }
{ id: 'Required-Start', value: '$remote_fs' }
{ id: 'Required-Stop', value: '$remote_fs' }
{ id: 'Default-Start', value: 'S' }
{ id: 'Default-Stop', value: undefined }
```

# Read more
npm package: @mh-cbon/sp-nsi-sc
Description: Parse service file used by nsi to consume windows sc
Author: mh-cbon
Latest version: 1.0.1

# sp-nsi-sc

Parse service file used by nsi to consume windows sc.

# install

```sh
npm i @mh-cbon/sp-nsi-sc
```

# usage

```js
var spNsiSc = require('@mh-cbon/sp-nsi-sc')
var fs = require('fs')

fs.createReadStream('./fixtures/1.cmd')
.pipe(spNsiSc())
.on('data', function (d) {
  console.log(d);
  /*
  [ { name: 'author', value: 'me' },
  { name: 'version', value: '6.6.6' },
  { name: 'description',
    value: 'The description of whatever this script does' },
  { env: false, name: 'wd', value: 'C:\\whatever\\' },
  { env: false, name: 'cmd', value: '""' },
  { env: false, name: 'stdout', value: '""' },
  { env: false, name: 'stderr', value: '""' },
  { env: true, name: 'some', value: 'thing' },
  { env: true, name: 'else', value: 'yep' } ]
  */
})

```
npm package: @mh-cbon/sp-nsi-sysv
Description: Parse service file used by nsi to consume sysv
Author: mh-cbon
Latest version: 1.0.1

# sp-nsi-sysv

Parse service file used by nsi to consume sysv.

# install

```sh
npm i @mh-cbon/sp-nsi-sysv
```

# Usage

```js
var spNsiSysv = require('@mh-cbon/sp-nsi-sysv')
var fs = require('fs')

fs.createReadStream('./fixtures/1.sh')
.pipe(spNsiSysv())
.on('data', function (d) {
  console.log(d);
  /*
  [ { name: 'author', value: ' me' },
  { env: false, name: 'name', value: '"!name"' },
  { env: false, name: 'wd', value: '"!wd"' },
  { env: false, name: 'cmd', value: '"!cmd"' },
  { env: false, name: 'reload', value: '"!reload"' },
  { env: false, name: 'user', value: '"!user"' },
  { env: false, name: 'pid_file', value: '"!pid"' },
  { env: false, name: 'stdout_log', value: '"!stdout"' },
  { env: false, name: 'stderr_log', value: '"!stderr"' },
  { env: true, name: 'MYVAR', value: '"MYVALUE"' } ]
  */
})
```

# See also

- https://github.com/mh-cbon/sp-lsbish
npm package: @mh-cbon/sp-upstart-stanzas
Description: Stream parser for upstart stanzas files
Author: mh-cbon
Latest version: 1.0.1

# sp-upstart-stanzas

Stream parser for upstart stanzas files

# Install

```sh
npm i @mh-cbon/sp-upstart-stanzas --save
```

# Usage
```js
var spUpstartStanzas = require('@mh-cbon/sp-upstart-stanzas')
var fs = require('fs')

var f = ''
f = 'fixtures/tty1.conf'
f = 'fixtures/wait-for-state.conf'
fs.createReadStream(f)
.pipe(spUpstartStanzas())
.on('data', function (d) {
  /*
  { type: 'stanzas',
  id: 'author',
  content: 'author "Clint Byrum <clint.byrum@canonical.com>"\n' }
{ type: 'stanzas',
  id: 'description',
  content: 'description "Waiting for state"\n\n' }
{ type: 'stanzas', id: 'task', content: 'task\n' }
{ type: 'stanzas',
  id: 'normal exit',
  content: 'normal exit 2\n\n' }
{ type: 'stanzas',
  id: 'stop on',
  content: 'stop on started $WAIT_FOR or stopped $WAIT_FOR\n\n' }
{ type: 'comment',
  content: '# These are all arguments for use influencing how this job waits\n' }
{ type: 'stanzas', id: 'env', content: 'env TIMEOUT=30\n' }
{ type: 'stanzas',
  id: 'env',
  content: 'env MANUAL_OVERRIDE="N"\n' }
{ type: 'stanzas', id: 'env', content: 'env WAIT_FOREVER="N"\n' }
{ type: 'stanzas',
  id: 'env',
  content: 'env WAIT_STATE="started"\n' }
{ type: 'stanzas',
  id: 'env',
  content: 'env TARGET_GOAL="start"\n\n' }
{ type: 'comment',
  content: '# Required args w/ no sensible default, the tests at the begin...' }
{ type: 'stanzas',
  id: 'instance',
  content: 'instance $WAITER$WAIT_FOR\n\n' }
{ type: 'stanzas',
  id: 'script',
  content: 'script\n    test -n "$WAIT_FOR" || exit 1\n    test -n "$WAITE...' }
  */
  console.log(d);
})
.on('end', function () {
  console.log('\n\n')
  spUpstartStanzas
  .parseFile(f)
  .on('data', function (stanzas) {
    /*
    [ { id: 'author',
        content: '"Clint Byrum <clint.byrum@canonical.com>"' },
      { id: 'description', content: '"Waiting for state"' },
      { id: 'task', content: '' },
      { id: 'normal exit', content: '2' },
      { id: 'stop on',
        content: 'started $WAIT_FOR or stopped $WAIT_FOR' },
      { id: 'env', content: 'TIMEOUT=30' },
      { id: 'env', content: 'MANUAL_OVERRIDE="N"' },
      { id: 'env', content: 'WAIT_FOREVER="N"' },
      { id: 'env', content: 'WAIT_STATE="started"' },
      { id: 'env', content: 'TARGET_GOAL="start"' },
      { id: 'instance', content: '$WAITER$WAIT_FOR' },
      { id: 'script',
        content: 'test -n "$WAIT_FOR" || exit 1\n    test -n "$WAITER"...' } ]
    */
    console.log(stanzas);
  })
})
```
npm package: @mh-cbon/sudo-fs
Description: Like fs module. To use with sudo / elevate. Works on linux, mac, windows.
Author: mh-cbon
Latest version: 1.0.17

# sudo-fs

Like fs module to use with sudo / elevate.

Works on linux, mac, windows.

Very partial port.

# install

```
npm i @mh-cbon/sudo-fs --save
```

# usage

```js
var fs = require('@mh-cbon/sudo-fs');

fs.createReadStream('some.file').pipe(process.stdout);
fs.createWriteStream('some.file').end('some data');
fs.writeFile('some.file', 'content', {}, function (err, data) {});
fs.readFile('some.file', {}, function (err, data) {});
fs.exists('some.file', function (maybe) {});
fs.chown('some.file', 'me', 'notyou', function (err) {});
fs.chmod('some.file', 0777, function (err) {});
fs.unlink('some.file', function (err) {});
fs.mkdir('some/dir', function (err) {});

```

# todo

- improve compatibility with node fs module.

# Tests

To run the tests you should use those commands,

To check with node API:
```
mode=node mocha
```

To check with linux yasudo API:
```
mode=linux yasudo=<your pwd> mocha
```

To check with windows wtf API:
```
mode=windows mocha
```
npm package: @mh-cbon/systemd-simple-api
Description: Systemd simple api to manage services
Author: mh-cbon
Latest version: 2.1.5

# systemd-simple-api

Simple api for node to interface with systemd bin.

# Install

```
npm i @mh-cbon/systemd-simple-api --save
```


# Usage

```js
var SystemdSimpleApi = require('@mh-cbon/systemd-simple-api');
var sds = new SystemdSimpleApi(/* version */);

// enable sudo
sds.enableElevation(''); // will now read the password from yasudo env variable
sds.enableElevation('the password'); // will now use 'the password'
sds.enableElevation(false); // will disable use of sudo

// systemctl --user -t service --all
sds.list(opts={user: true, t: 'service', all: true}, function (err, items) {
  console.log(items);
})

// systemctl -t timers
sds.list(opts={t: 'timers'}, function (err, items) {
  console.log(items);
})

// systemctl list-unit-files --user
sds.listUnitFiles(opts={user: true}, function (err, items) {
  console.log(items);
})

// systemctl show serviceId --user
sds.describe('serviceId', opts={user: true}, function (err, info) {
  console.log(info);
})

// systemctl start serviceId --user
sds.start('serviceId', opts={user: true}, function (err) {
  console.log(err);
})

// systemctl stop serviceId --user
sds.stop('serviceId', opts={user: true}, function (err) {
  console.log(err);
})

// systemctl reload serviceId --user
sds.reload(opts={user: true}, function (err) {
  console.log(err);
})

// systemctl reload-or-restart serviceId --user
sds.reloadOrRestart(opts={user: true}, function (err) {
  console.log(err);
})

// systemctl daemon-reload
sds.refresh(function () {
  console.log('systemd is refreshed')
})

```

## Install a service

```js
// per user
var service = {
  install:{},
  unit: {
    Description: "your service"
  },
  service: {
    ExecStart: '/bin/sh ...'
  }
}
sds.install({user: true, id: 'fake', properties: service}, done)

// system wide
var service = {
  install:{},
  unit: {
    Description: "your service"
  },
  service: {
    ExecStart: '/bin/sh ...'
  }
}
sds.install({user: !true, id: 'fake', properties: service}, done)


// later...
sds.uninstall({user: !true, id: 'fake', properties: service}, done)
```

## Run the tests

- install vagrant
- run `npm run test-fedora`

# Read more

- https://coreos.com/os/docs/latest/using-environment-variables-in-systemd-units.html
- https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files
- https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
- https://www.freedesktop.org/software/systemd/man/systemd.unit.html#id-1.7.4
- https://www.freedesktop.org/software/systemd/man/systemd.service.html#
- https://www.freedesktop.org/software/systemd/man/systemd.exec.html#
- https://www.freedesktop.org/software/systemd/man/systemd.kill.html#
- https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet
npm package: @mh-cbon/tail-fs-readable
Description: A readable stream to tail a file
Author: mh-cbon
Latest version: 1.0.4

# tail-fs-readable

A readable stream to tail a file.

Works with files

- not existing yet
- deleted meanwhile
- reduced meanwhile
- appended meanwhile

# install

```sh
npm i @mh-cbon/tail-fs-readable --save
```

# Usage

```js
var tailFs = require('@mh-cbon/tail-fs-readable');

var stream = tailFs('somefile')
.on('data', function (d) {
  console.log('DATA %s', d.toString())
})
.on('end', function () {
  console.log('END')
})
.on('reached-end', function () {
  console.log('REACHED END')
})
.on('close', function () {
  console.log('CLOSE')
});

stream.pipe(process.stdout);

setTimeout(function () {
  stream.close();
}, 1500)
```

### Options

`touchToRefresh`

if `true`, `tail-fs-readable` will consider the
file as completely changed if its `mtime` is different,
but the size is identical.

if `false`, `tail-fs-readable` will not be able to detect a modified file
with a different content, but the same size.

It s about this particular case :

```sh
echo "some" > tailed.txt
echo "else" > tailed.txt
```

# As a binary

```sh
npm i @mh-cbon/tail-fs-readable -g
tailf some.txt
  ctrl+c to quit
```
npm package: @mh-cbon/upstart-simple-api
Description: Simple and limited api to interface with upstart
Author: mh-cbon
Latest version: 1.0.18

# upstart-simple-api

Simple and limited api to interface with upstart.

# install

```sh
npm i @mh-cbon/upstart-simple-api --save
```

# usage

Beware,

- user jobs are not well tested because they cannot be initialized easily with a vagrant ubuntu box.
- `describe` method is quiet limited in regard of upstart script language, it is intended.


```js
var UpstartSimpleApi = require('@mh-cbon/upstart-simple-api');
var usapi = new UpstartSimpleApi(/* version */);

// initctl list
usapi.list(opts={}, function (err, items) {
  console.log(items);
})

// initctl show-config serviceId
sds.describe('serviceId', opts={}, function (err, info) {
  console.log(info);
})

// initctl start serviceId
sds.start('serviceId', opts={}, function (err) {
  console.log(err);
})

// initctl stop serviceId
sds.stop('serviceId', opts={}, function (err) {
  console.log(err);
})

// initctl reload serviceId
sds.reload('serviceId', function (err) {
  console.log(err);
})

// initctl reload-configuration serviceId
sds.reloadConfiguration('serviceId', function (err) {
  console.log(err);
})
```

## Install a Service

```js
// per user
var service = {
  user: true,
  id: 'fake',
  stanzas: [
    {
      name: 'author',
      value: 'whatever'
    },
    {
      name: 'exec',
      value: '/bin/sh ...'
    }
  ]
}
usapi.install(service, done)

// system wide
var service = {
  user: !true,
  id: 'fake',
  stanzas: [
    {
      name: 'author',
      value: 'whatever'
    },
    {
      name: 'exec',
      value: '/bin/sh ...'
    }
  ]
}
usapi.install(service, done)


// later...
usapi.uninstall(service, done)
```


# read more

- http://askubuntu.com/questions/637305/how-do-i-control-an-upstart-session-job-over-ssh
- http://upstart.ubuntu.com/cookbook/#joining-a-session
- http://upstart.ubuntu.com/cookbook/#session-init
- http://upstart.ubuntu.com/wiki/Stanzas
- http://dev.deluge-torrent.org/wiki/UserGuide/Service/Upstart
- http://minecraft.gamepedia.com/Tutorials/Ubuntu_startup_script
- https://www.nginx.com/resources/wiki/start/topics/examples/ubuntuupstart/#
- https://www.exratione.com/2013/02/nodejs-and-forever-as-a-service-simple-upstart-and-init-scripts-for-ubuntu/
npm package: @mh-cbon/uri-to-stream
Description: Transforms an uri string to a stream
Author: mh-cbon
Latest version: 1.0.3

# uri-to-stream

Transforms an uri string to a stream

# install

```
npm i @mh-cbon/uri-to-stream --save
```

# usage

```js
var uriToStream = require('uri-to-stream');

uriToStream.read(__dirname + '/index.js').pipe(process.stdout);
uriToStream.read('http://google.com').pipe(process.stdout);
uriToStream.read('tcp://something.to.read:1337');


uriToStream.write(__dirname + '/test/write').end('tomate');
uriToStream.write('http://google.com').end('yahoo');
uriToStream.write('tcp://something.to.write:1337');

```

For convenience it also supports Object addresses

```js
var uriToStream = require('uri-to-stream');

uriToStream.read({
  protocol: 'http:',
  port: '8000',
  hostname: '127.0.0.1'
}).pipe(process.stdout);

uriToStream.read({
  port: '8000',
  host: '127.0.0.1'
});

uriToStream.write({
  protocol: 'http:',
  port: '8000',
  hostname: '127.0.0.1'
}).end('tomate');

uriToStream.write({
  port: '8000',
  host: '127.0.0.1'
}).end('yahoo');

```

# todo

- support ssl