View master.js
const cluster = require('cluster');
const numCPUs = require('os').cpus().length;
var tasks = [
"Dusting",
"Sweeping",
"Vacuuming",
"Washing dishes",
"Feeding pets",
"Doing laundry",
View ripple-cli.js
#!/usr/bin/env node
/**
* Ripple CLI tool
*
* The MIT License (MIT)
* Copyright (c) 2017 akirattii <tanaka.akira.2006@gmail.com> (http://mint.pepper.jp)
*/
/**
# Usage & example:
View CheckReCAPTCHA.js
/**
* reCAPTCHA checking middleware
*
* Usage:
* ```
* var checkReCAPTCHA = require("../middleware/CheckReCAPTCHA.js").checkReCAPTCHA;
* router.post('/hoge',
* checkReCAPTCHA(),
* function(req, res, next) {
* //
View さくらのVPSで契約してからユーザを作ってSSHでログインするまで.md

VPS契約してからユーザを作ってSSHでログインするまで

前提:

  • さくらのVPS
  • WebコンソールからログインしてOS (Ubuntu 16.04 LTS) をインストール済み
  • sshデーモン起動済み

ユーザを作成

View nginx-basic-auth-setup.md

Simple Basic Authentication setup for nginx:

$ sudo apt-get install nginx

$ sudo sh -c "echo -n '<username>:' >> /etc/nginx/.htpasswd"
$ sudo sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd"
Password: <password>
Verifying - Password: <password>
View express-response-qrcode-binary.js
var express = require('express');
var router = express.Router();
// const fs = require('fs');
var QRCode = require('qrcode');
router.get('/test/image', function(req, res, next) {
res.writeHead(200, { 'Content-Type': 'image/png' });
QRCode.toDataURL('I am a pony!', function(err, dataurl) {
View RippleTxParser.js
/**
* Ripple Transaction Parser
*
* Usage:
*
* 1) You get Ripple `transaction` data by any way.
* for example, below gets RPC response data of such as `account_tx`:
* ```
* $ curl --data-binary '{"jsonrpc":"2.0","id":0,"method":"account_tx","params":[{"account":"rHDvn877ezKZokt9WWeVhjwfab53o4pjw1","binary":false,"count":false,"descending":true,"forward":false,"ledger_index_max":-1,"ledger_index_min":-1,"limit":3,"offset":0}]}' https://api.altnet.rippletest.net:51234
* ```
View docker-mysql-slow-query-log.md

Check running mysql container:

$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
26137efa979f        mysql               "docker-entrypoint..."   8 months ago        Up 10 minutes       0.0.0.0:3306->3306/tcp   container-mysql

Check docker container mysql version:

$ sudo docker exec container-mysql mysqld --version`
mysqld  Ver 5.7.15 for Linux on x86_64 (MySQL Community Server (GPL))
View example-alice-bob-message-verify.js
const crypto = require('crypto');
const secp256k1 = require('secp256k1');
// or require('secp256k1/elliptic')
// if you want to use pure js implementation in node
const msg = process.argv[2]; // message to be signed you pass
const digested = digest(msg);
console.log(`0) Alice's message:
message: ${msg}
message digest: ${digested.toString("hex")}`);
View fetchAddressByZipcode.js
/**
* Fetch address by zipcode
*/
function fetchAddressByZipcode(zipcode, cb) {
let url = "http://zipcloud.ibsnet.co.jp/api/search?callback=?&zipcode=" + zipcode;
$.getJSON(url).done((data, status, jqXHR) => {
let result = data["results"][0];
vm.prefecture = result["address1"];
vm.city = result["address2"];