Skip to content

Instantly share code, notes, and snippets.

Goki Mori kozakana

Block or report user

Report or block kozakana

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kozakana
kozakana / gcv_api.rb
Last active Jun 22, 2019
Using Google cloud vision easily
View gcv_api.rb
require 'google/apis/vision_v1'
class GcvApi
def initialize api_key, option={}
default = {
retry: 5,
max_results: 2048,
language_hints: 'ja'
}
@option = default.merge option
@kozakana
kozakana / cloud_front_ips.sh
Last active Jun 13, 2017
CloudFrontのIPアドレスを取得してnginxのset_real_ip_fromの形式で出力
View cloud_front_ips.sh
curl -s "https://ip-ranges.amazonaws.com/ip-ranges.json" |jq -r '.prefixes | map(select(.service == "CLOUDFRONT").ip_prefix) | "set_real_ip_from" + " " + .[] + ";"'
@kozakana
kozakana / body01.tmpl
Last active Jan 2, 2017
マークダウンを将棋用に拡張したフォーマットのngx_mruby版
View body01.tmpl
</body>
</article>
</html>
@kozakana
kozakana / MT_Average.rb
Last active Aug 29, 2015
Rubyで使用されている乱数の均等分布について(メルセンヌ・ツイスタ) ref: http://qiita.com/kozakana/items/b5229094cf8d29767847
View MT_Average.rb
MAX_VAL = 101
REP_CNT = 10**6
sum = 0.0
prng = Random.new(Random.new_seed)
(0...REP_CNT).each{|idx|
p sum = (sum*idx + prng.rand(MAX_VAL))/(idx+1)
}
You can’t perform that action at this time.