Skip to content

Instantly share code, notes, and snippets.

View you21979's full-sized avatar
💭
I may be slow to respond.

Yuki Akiyama you21979

💭
I may be slow to respond.
View GitHub Profile
@you21979
you21979 / gist:1d312caf84f0a649e5ec7424fcb6baa2
Created September 23, 2016 03:25
振り分け抽選方式
ガチャのロジック
レジェンド、エピック、アンコモン、コモンなどに等級を分ける
それぞれ1、5、40、54と確率を割り振る
乱数を100でmodをとり、どの等級が当たるか確定させる(振り分け抽選)
次に等級に存在するカード枚数で乱数をmodする
その結果で決まる
この方法の良いところは重み付け方式よりもガチャの確率がわかりやすいところであるしデバッグも楽である
@you21979
you21979 / a.md
Last active October 17, 2016 09:36
質量保存の法則から運動でダイエットをしても痩せない理由

質量保存の法則から運動でダイエットをしても痩せない理由

有酸素運動で消費するエネルギーを計算してみよう

消費エネルギーの方式

  • 体重(㎏)×距離(㎞)=消費エネルギー(kcal)
  • 基礎代謝1500kcal

ダイエットなので70kg 普通の人が15分で走れる距離3km(かなり辛いよ)

ブコメ:糖質摂取→グルコーススパイク→血管炎症→LDL増加。この流れを理解している人は砂糖に限らず米も小麦も控えめにします。
http://gigazine.net/news/20160913-sugar-industry/
>1950年代から1960年代初頭にかけての砂糖に関する研究では、低脂肪で糖分の多い食事が体内のコレステロール値を大きく上昇させることを裏付けるデータがそろっています。しかし、製糖業界は圧力をかけてこれらの研究結果をなかったものにしていきます。
マクガバンレポートが出てアメリカ人の炭水化物比率が高まる以前からわかっていた
1975年にアメリカ上院栄養問題特別委員会によってまとめられた「マクガバンレポート」
@you21979
you21979 / gist:7324028b48b833dd7ac97e56532ddf6f
Last active October 28, 2016 07:23
2017年勉強したいリスト
* interledger
* lightning
* ipfs
* iota
@you21979
you21979 / testnet.js
Created November 10, 2016 13:46
coinomiウォレット救済ツール
const bitcoin = require("bitcoinjs-lib")
const bip39 = require('bip39')
const bip32utils = require('bip32-utils')
const insight = require('insight-cli').RestClient
const bip44_account = (m, BIP44) => m.deriveHardened(BIP44.PURPOSE).deriveHardened(BIP44.COINTYPE).deriveHardened(BIP44.ACCOUNT)
const mnemonic = ""
const seed = bip39.mnemonicToSeed(mnemonic, "")
@you21979
you21979 / hdnode.md
Last active June 25, 2018 04:36
bitcoinjs-lib hdnode snipet

mnemonic generate

12 word

const mnemonic = bip39.generateMnemonic();

24 word

@you21979
you21979 / a.md
Last active December 27, 2016 07:31
counterparty

https://www.youtube.com/watch?v=5yP7pvQynb4

  • bitcoinのトランザクションだけでデータを完結している
  • bitcoinのトランザクション内にカウンターパーティのデータを紛れ込ませる
  • 1of3のmultisig内に偽装してデータを埋め込む
  • トランザクションにはトークン名と残高を記録
  • counterpartydはビットコインのブロックチェーンをウォッチして独自データベースに集計する
const fees = require('bitcoinfees-21co');
const task = require('promise-util-task');
const munin = require('munin-plugin');
const api = fees.FeesApi;
const graphRecommended = (res) => {
const g = new munin.Graph('bitcoin feerate','satoshi/byte','bitcoin');
Object.keys(res).forEach(key => {
g.add(new munin.Model.Default(key).setValue(res[key]));
})
const net = require('net');
const responseParser = require('http-string-parser').parseResponse;
const makeCookieAuth = (user, password) => {
return new Buffer(user + ':' + password).toString('base64')
}
const makeRequest = (method, params, id) => {
return JSON.stringify({
jsonrpc : "2.0",