This file contains 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
$ benchmark-driver benchmark.yml --rbenv '2.0.0::2.0.0-p648 --disable-gems;2.5.3::2.5.3 --disable-gems;2.6.0-preview3::trunk --disable-gems;2.6.0-preview3+JIT::trunk --disable-gems --jit' -v --repeat-count 24 | |
2.0.0: ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux] | |
2.5.3: ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux] | |
2.6.0-preview3: ruby 2.6.0dev (2018-10-31 trunk 65474) [x86_64-linux] | |
2.6.0-preview3+JIT: ruby 2.6.0dev (2018-10-31 trunk 65474) +JIT [x86_64-linux] | |
Calculating ------------------------------------- | |
2.0.0 2.5.3 2.6.0-preview3 2.6.0-preview3+JIT | |
Optcarrot Lan_Master.nes 34.548 48.314 54.535 85.690 fps | |
Comparison: |
This file contains 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
$ cat benchmark.yml | |
# Config for benchmark_driver.gem | |
type: command_stdout | |
name: optcarrot | |
command: bin/optcarrot --benchmark examples/Lan_Master.nes | |
metrics_type: | |
unit: fps | |
stdout_to_metrics: | | |
match = stdout.match(/^fps: (?<fps>\d+\.\d+)$/) | |
Float(match[:fps]) |
This file contains 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
# based on ruby/benchmark/bm_erb_render.rb | |
require 'benchmark/ips' | |
require 'erb' | |
require 'erubi' | |
require 'erubis' | |
data = DATA.read | |
mod = Module.new | |
mod.instance_eval("def self.erb(title, content); #{ERB.new(data).src}; end", "(ERB)") |
This file contains 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
#!/bin/sh | |
if git-rev-parse --verify HEAD >/dev/null 2>&1 | |
then | |
against=HEAD | |
else | |
# Initial commit: diff against an empty tree object | |
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 | |
fi |
This file contains 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
# --- Usage --- | |
# ruby kmb.rb init | |
# ruby kmb.rb change | |
require 'twitter' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'fileutils' | |
Twitter.configure do |config| |
This file contains 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 'twitter' | |
Twitter.configure do |config| | |
config.consumer_key = '' | |
config.consumer_secret = '' | |
config.oauth_token = '' | |
config.oauth_token_secret = '' | |
end | |
print "Input list name: " |
This file contains 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 'RMagick' | |
bmp_file_name = ARGV[0] | |
image = Magick::Image.read(bmp_file_name).first | |
top_left_pixel = image.pixel_color(0, 0) | |
top_left_color = top_left_pixel.to_color(Magick::AllCompliance, false, 8, true) | |
png_file_name = bmp_file_name.gsub(/bmp$/, 'png') | |
`convert -transparent "#{top_left_color}" #{bmp_file_name} #{png_file_name}` |
This file contains 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 'user_stream' | |
require 'twitter' | |
require "net/http" | |
require "uri" | |
def notify(message) | |
uri = URI.parse("http://im.kayac.com/api/post/USERNAME") | |
Net::HTTP.start(uri.host, uri.port){|http| | |
request = Net::HTTP::Post.new(uri.path) |
This file contains 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 'oauth' | |
require 'thor' | |
require 'thor/group' | |
class Auth < Thor::Group | |
include Thor::Actions | |
def get_pid | |
consumer = OAuth::Consumer.new( | |
'IQKbtAYlXLripLGPWd0HUA', |
This file contains 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 "net/http" | |
require "uri" | |
uri = URI.parse("http://im.kayac.com/api/post/USERNAME") | |
Net::HTTP.start(uri.host, uri.port){|http| | |
request = Net::HTTP::Post.new(uri.path) | |
request.set_form_data({:message=>"MESSAGE"}) | |
response = http.request(request) | |
} |
NewerOlder