Skip to content

Instantly share code, notes, and snippets.

View shogochiai's full-sized avatar
🚀
coding

Shogo Ochiai shogochiai

🚀
coding
View GitHub Profile
@shogochiai
shogochiai / addr2hex.js
Created May 3, 2020 04:45
For Tezos with ConseilJS
const conseil = require('conseiljs');
require('dotenv').config();
(async _=>{
const addr = await conseil.TezosMessageUtils.writeAddress(process.argv[process.argv.length - 1])
console.log(`${process.argv[process.argv.length - 1]} to 0x${addr}`)
console.log("Put it to .env")
})()
#!/bin/bash
# Discussion, issues and change requests at:
# https://github.com/nodesource/distributions
#
# Script to install the NodeSource Node.js 13.x repo onto a
# Debian or Ubuntu system.
#
# Run as root or insert `sudo -E` before `bash`:
#
#!/bin/bash
# For
# - ubuntu18.04
# - t2.medium
# - Security Rule: port 22,25,80,443
# - EBS 16GB
# - Discourse v2.3.0.beta9
# - Amazon SES
# - bash ./discourse-build.sh forum bitcoin.com AKKSISNHFDCVBPDEOJBN BCokAid4stoJaOKSqnRJXpwJKKSvuA7thhomFajjKAp/
@shogochiai
shogochiai / merkle.ex
Last active September 5, 2018 11:34
MerkleProof learning purpose
defmodule MerkleTree.Node do
@moduledoc """
This module implements a tree node abstraction.
"""
defstruct [:value, :children, :height]
@type t :: %__MODULE__{
value: String.t,
children: [MerkleTree.Node.t],
@shogochiai
shogochiai / ethresearch-localizer.js
Last active April 12, 2018 14:44
Fetch ethresear.ch to local. Because I wanna put it on newtab on chrome and I wanna render it faster.
/*
* Minimum requirement: NodeJS 8.0.0
* Put `*/15 * * * * /path/to/wget https://ethresear.ch -O /tmp/ethresear.ch >/tmp/stdout.log 2>/tmp/stderr.log && /path/to/node /path/to/ethresearch-localizer.js`
*/
const cheerio = require('cheerio')
const fs = require('fs')
const LOCAL_FILE = "/tmp/ethresear.ch"
const html = fs.readFileSync(LOCAL_FILE)
const $ = cheerio.load(html)
/*
* This public doc will be uploaded on https://gist.github.com/shogochiai/5fa45042aaca90784ee3b4be392d74c1
* Requirement:
* - Higher than NodeJS-v8.0.0
* - Install command "npm i cryptr axios"
* - api_key and api_secret will be passed from VIPPLAZA
*/
const Cryptr = require('cryptr')
const axios = require('axios')
const api_key = '$2a$20$1cu/Xyu2vZpPj3eUkWkWCeqM0X5EIF/.3yApaEIy8GwBMWDmva5ZK'
0x00b10A5395348134388F0bdC0C348e782361F440
万万,万中,万久,万仁,万保,万元,万勝,万吉,万同,万和,万喜,万嘉,万国,万大,万天,万字,万安,万宝,万寛,万寿,万平,万康,万延,万建,万弘,万徳,万応,万感,万慶,万成,万承,万授,万政,万文,万斉,万昌,万明,万景,万暦,万正,万永,万治,万泰,万白,万神,万祥,万禄,万福,万至,万興,万護,万貞,万長,万修,万改,中万,中中,中久,中仁,中保,中元,中勝,中吉,中同,中和,中喜,中嘉,中国,中大,中天,中字,中安,中宝,中寛,中寿,中平,中康,中延,中建,中弘,中徳,中応,中感,中慶,中成,中承,中授,中政,中文,中斉,中昌,中明,中景,中暦,中正,中永,中治,中泰,中白,中神,中祥,中禄,中福,中至,中興,中護,中貞,中長,中修,中改,久万,久中,久久,久仁,久保,久元,久勝,久吉,久同,久和,久喜,久嘉,久国,久大,久天,久字,久安,久宝,久寛,久寿,久平,久康,久延,久建,久弘,久徳,久応,久感,久慶,久成,久承,久授,久政,久文,久斉,久昌,久明,久景,久暦,久正,久永,久治,久泰,久白,久神,久祥,久禄,久福,久至,久興,久護,久貞,久長,久修,久改,仁万,仁中,仁久,仁仁,仁保,仁元,仁勝,仁吉,仁同,仁和,仁喜,仁嘉,仁国,仁大,仁天,仁字,仁安,仁宝,仁寛,仁寿,仁平,仁康,仁延,仁建,仁弘,仁徳,仁応,仁感,仁慶,仁成,仁承,仁授,仁政,仁文,仁斉,仁昌,仁明,仁景,仁暦,仁正,仁永,仁治,仁泰,仁白,仁神,仁祥,仁禄,仁福,仁至,仁興,仁護,仁貞,仁長,仁修,仁改,保万,保中,保久,保仁,保保,保元,保勝,保吉,保同,保和,保喜,保嘉,保国,保大,保天,保字,保安,保宝,保寛,保寿,保平,保康,保延,保建,保弘,保徳,保応,保感,保慶,保成,保承,保授,保政,保文,保斉,保昌,保明,保景,保暦,保正,保永,保治,保泰,保白,保神,保祥,保禄,保福,保至,保興,保護,保貞,保長,保修,保改,元万,元中,元久,元仁,元保,元元,元勝,元吉,元同,元和,元喜,元嘉,元国,元大,元天,元字,元安,元宝,元寛,元寿,元平,元康,元延,元建,元弘,元徳,元応,元感,元慶,元成,元承,元授,元政,元文,元斉,元昌,元明,元景,元暦,元正,元永,元治,元泰,元白,元神,元祥,元禄,元福,元至,元興,元護,元貞,元長,元修,元改,勝万,勝中,勝久,勝仁,勝保,勝元,勝勝,勝吉,勝同,勝和,勝喜,勝
@shogochiai
shogochiai / gist:5ae52b1e606996132edf
Last active August 29, 2015 14:23
security_model.md

#概説

honeybaseという名のフレームワークの、route毎のアクセス制限の実装案です。

ホワイトリスト形式でアクセス可能なpath, table, action, role, paramsの組み合わせを定義します 登録されていない組み合わせによるアクセス全て拒否します。 このファイルはphp(laravel)製のhoneybase-server側で読み込まれます。RailsやRevel(go)でも同じように実装します。 全ての/api/v1以下のAPI(honeybase interface)を用いるrequestにフィルタ処理をかけます。

http通信のリファラを元にpathを判断し、honeybase-clientの通信が持つtable, action, current_user, params情報を元にtable, action, roke, paramsがマッチするか判定します。

@shogochiai
shogochiai / readme.md
Last active August 29, 2015 14:18
docker-composeでsinatra/redisを動かす