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
| find . -name "*.xml" -print0 | xargs -0 ruby -i -p -e '$_.gsub! %r{hoge}, "fuga"' |
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
| Parent = { | |
| hoge = 1 | |
| } | |
| function Parent:new (o) | |
| o = o or {} | |
| setmetatable(o, self) | |
| self.__index = self | |
| return o | |
| 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
| it "normal" do | |
| a = [{id: 1, weight:1}, {id:2, weight: 3}, {id:3, weight:nil}] | |
| check_count = 10 | |
| check_count.times do | |
| sample_count = 1000 | |
| counts = {1 => 0, 2 => 0} | |
| sample_count.times do | |
| counts[a.sample_with_weight[:id]] += 1 | |
| end | |
| (counts[1] < counts[2]).should be_true |
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
| local group = display.newGroup() | |
| local rect1 = display.newRect(0, 0, 50, 1000) | |
| rect1:setFillColor(255, 0, 0) | |
| local rect2 = display.newRect(0, 0, 1000, 50) | |
| rect2:setFillColor(0, 255, 0) | |
| group:insert(rect1) | |
| group:insert(rect2) |
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
| #!/usr/bin/env ruby | |
| File.open('ids.txt') do |file| | |
| while line = file.gets do | |
| words = line.split(' ') | |
| size = eval(words[1].gsub('x', '*')) | |
| if size >= 640 * 960 | |
| p(words) | |
| 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 -*- | |
| # mackrel-client-ruby 0.0.2 使用 | |
| require 'mackerel' | |
| client = Mackerel::Client.new(:mackerel_api_key => ENV['MACKEREL_APIKEY']) | |
| client.get_hosts(service: 'service_name').each do |host| | |
| # working以外で初期登録から一週間以上経過している | |
| if host.status != "working" && host.createdAt < Time.now.to_i - (60 * 60 * 24 * 7) | |
| p "retire host id:#{host.id}" | |
| p client.retire_host(host.id) |
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
| [global] | |
| ioengine=libaio | |
| iodepth=1 | |
| size=1g | |
| direct=1 | |
| runtime=60 | |
| directory=${TARGET} | |
| stonewall | |
| [Seq-Read] |
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
| let locale = "jp" | |
| let blacklists = ["*://mail.google.com/*","*://mail.google.com/*","*://mail.google.com/mail/*","*://www.inoreader.com/*","docs.google.com"] | |
| let mapleader = "," | |
| map ; : | |
| map : ; | |
| " macでSKKの変換と同時に動く為無視する | |
| imap <C-j> <Nop> |