View server.js
/*
Run server by forever with `--killSignal=SIGTERM`:
```
$ forever --killSignal=SIGTERM start ./server.js
```
Now `gracefulShutdown` function is called when you stop the server by `forever stop`:
```
View form-validator.js
/*
Simple Form Validator
@dependencies: vue.js, bootstrap4
@see: https://gist.github.com/akirattii/83937626062fc38f8f1ac5c91f172e72
# Usage
Code html:
First, load `FormValidator` after vue loaded:
```
View example-call-bitcoind.js
//
// An example of a bitcoind JSON RPC request.
//
// Example request of curl:
// $ curl --data-binary '{"jsonrpc": "1.0", "id":"hoge", "method": "getblockhash", "params": [9999] }' http://rpc:rpc@127.0.0.1:18332/
//
const URL = "http://rpc:rpc@127.0.0.1:18332"; // bitcoind testnet. user:"rpc", password:"rpc"
const RpcClient = require("./rpc-client.js");
View mysql-check-dbsize-and-shrink.sql
-- https://stackoverflow.com/questions/1733507/how-to-get-size-of-mysql-database
mysql>
SELECT table_schema
"DB Name",
Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM information_schema.tables
GROUP BY table_schema;
-- RESULT:
-- +-----------------------+---------------+
View server.js
var express = require('express');
var app = express();
var fs = require('fs');
app.get('/', function(req, res) {
res.send("hello");
// Notice: Make any uncaughtException happend on purpose
fs.readFile('no_such_file.txt', function(err, data) {
if (err) throw err;
console.log(data);
View cluster.js
const cluster = require('cluster');
const numCPUs = require('os').cpus().length;
//
// ** SharedMemory which is shared among every worker:
//
// dont use `var`
SharedMemory = {
// shared data:
View AppError.js
/** application error base */
module.exports.AppError = class AppError extends Error {
constructor(message) {
super(message);
this.name = this.constructor.name
Error.captureStackTrace(this, this.constructor);
}
};
//
View app.js
/*
0) start node app:
$ node app.js
1) start stream listening:
browse to http://localhost:3000/
2) stop stream listening:
browse to http://localhost:3000/stop
*/
View .bash_profile
source ~/.bashrc
View how-to-use-jquery-ui-with-browserify.md

Install jquery & jquery-ui:

$ npm install --save jquery jquery-ui

Install deamdify:

$ npm install --save-dev deamdify