View QRReader.js
/**
QR code Reader Library
@dependencies:
+ https://github.com/LazarSoft/jsqrcode
(https://webqr.com/llqrcode.js)
+ jQuery (+ Bootstrap4)
@author: akirattii <tanaka.akira.2006@gmail.com> (http://mint.pepper.jp)
View parseBitcoinProtocolLink.js
View bitcoin.testnet.conf
# /root/.bitcoin-config/bitcoin.testnet.conf
testnet=1
rpcuser=rpc
rpcpassword=rpc
server=1
printtoconsole=1
rpcallowip=0.0.0.0/0
rpcthreads=50
rpctimeout=300
txindex=1
View get-host-ip-from-docker-container.sh
# First, login container like this:
$ docker exec -it <container> /bin/bash
# Now you are in the container, try to get host's IP address like this:
$ /sbin/ip route|awk '/default/ { print $3 }'
View Mnemonic.js
// Imported from js/external/mnemonic.js of Counterwallet@github
// and changed to CommonJS style
exports.getInstance = function(args) {
var bits, i, l, w1, w2, w3, n;
if (typeof args == "undefined" || typeof args == "number") {
bits = args || 96;
if (bits % 32 !== 0)
throw "Can only generate 32/64/96/128 bit passwords";
this.random = new Uint32Array(bits / 32);
if (window.crypto && window.crypto.getRandomValues)
View gen_address_aliases_address_hash.js
/*
メモ:Counterblock API の "get_preferences" が吐き出す address_aliases に含まれているハッシュ化されたアドレスは、以下のようなロジックで生成されている。
*/
var CryptoJS = require("crypto-js");
var addr = 'mkcpH67kGUUzVBpKU5P5QkPT48DygcjCgQ'; // address
var base64 = CryptoJS.SHA256(addr).toString(CryptoJS.enc.Base64);
console.log("ハッシュ化されたアドレス:", base64); // 'MvB0qNP3dcHwbatXgFkST2wmc5/D+Pmq/1zgetO0EQc='
/*
View make-zipcode-database.md

郵便局のHPからken_all.zipをダウンロード(Download zipcode CSV file "ken_all.zip"):

$ wget http://www.post.japanpost.jp/zipcode/dl/kogaki/zip/ken_all.zip

ZIPを解凍(Extract KEN_ALL.CSV from ken_all.zip):

$ unzip ken_all.zip
View urlencoding-by-charset.js
// npm install encoding-japanese
const encoding = require('encoding-japanese');
urlEncode("", "EUCJP"); // "%CC%DF"
function urlEncode(str, charset) {
let eucArray = encoding.convert(Encoding.stringToCode(str), charset);
return encoding.urlEncode(eucArray);
}
View deasync-example.js
var deasync = require('deasync');
// any async function error-first callback styled
function asyncFn(p, cb) {
let res = "hello " + p;
let err = null;
return cb && cb(err, res);
}
/** Use as async */
View lineread-and-write.js
/*
* Read and write every line of input.txt into output.txt
*/
const fs = require("fs");
var writeStream = fs.createWriteStream("output.txt");
var lineReader = require('readline').createInterface({
input: require('fs').createReadStream("input.txt")