This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
probs = Hash.new { |h,k| h[k] = {} } | |
STDIN.each do |l| | |
d = JSON.load(l.chomp) | |
probs[d['l']][d['r']] = (d['prob'] * 1000).to_i | |
end | |
def gen(probs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import random | |
import difflib | |
import json | |
import csv | |
import sort_runner as sr | |
GAMMA = 0.8 | |
EPSILON_INIT = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ConsistentHash where | |
import Data.Map as M | |
import Data.List as L | |
import Data.ByteString.Lazy.Char8 | |
import Data.Digest.Pure.MD5 hiding (hash) | |
type Key = String | |
type Node = Key | |
type Nodes = [Node] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Keyboard | |
import Signal (..) | |
import Time (..) | |
import Color(rgb) | |
import Graphics.Element (..) | |
import Graphics.Collage (..) | |
import Random | |
import Time | |
type ClawPos = Left | Right |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'pp' | |
require 'rubicure' | |
module PrettyCurePrinter | |
# 設定ファイルに書いた方がいい | |
# precure_name => [foreground, background] | |
PRECURE_COLOR_SETTING = { | |
'キュアブラック' => [:white, :black], | |
'キュアホワイト' => [:black, :white], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meata charset="UTF-8"> | |
<title>HashColor</title> | |
<style> | |
body { | |
text-align: center; | |
font-family: arial; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guard :shell do | |
watch 'tmp.md' do |f| | |
lines = open(f.first).readlines | |
file_name = $~[1] if lines.any?{ |l| l =~ /^__(.+)__$/ } | |
category = $~[1] if lines.any?{ |l| l =~ /^\[(.+)\]$/ } | |
if file_name && category | |
FileUtils.mkdir_p(category) | |
FileUtils.cp 'tmp.md', category + '/' + file_name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rainbow' | |
class WordFreq < Hash | |
def initialize | |
super(0) | |
end | |
def add(w) | |
self[w] += 1 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# https://twitter.com/katzchang/status/444136941605224448 | |
# is(hoge('2014-01-01 01:00', '2014-01-01 03:00'), ('2014-01-01 01:00', '2014-01-01 02:00', '2014-01-01 03:00')) より | |
# 1時間単位で開始時間と終了時間が与えられたとき => YYYY-mm-dd HH:00 が入力されるものだと予想 | |
# 寝る | |
require 'time' | |
module RefinedTime |
NewerOlder