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
#!ruby -Ks | |
require 'vr/vruby' | |
require 'vr/vrcontrol' | |
require 'win32/clipboard' | |
class Frm_form1 < VRForm | |
@caps_flag = false | |
def _form1_init |
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
# [0-9]{4} (unique) | |
Array.new(10) {|i| i }.shuffle.slice(0, 4) |
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
#!ruby | |
mms_list = [] | |
Dir.glob("*.asx") do |fn| | |
File.open(fn) {|f| | |
mms_list << f.read.scan(/(mms:.*?)"/) | |
} | |
end | |
File.open("mms_list.txt", "a") {|f| |
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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use File::Find; | |
use File::Copy; | |
use Encode; | |
my $target_dir = $ARGV[0]; | |
my $option = $ARGV[1]; |
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
#!ruby | |
require 'open-uri' | |
loop do | |
outfile = "C:/data/fujii_#{Time.now.strftime('%Y%m%d%H%M%S')}.jpg" | |
open(outfile, "wb") do |output| | |
open("http://live10.shogi.or.jp/oui/camera/3/fujii.jpg") do |data| | |
output.write(data.read) | |
puts outfile |
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
ruby -r fileutils -e "Dir.glob('*').each_with_index {|fn, i| FileUtils.mv fn, fn.sub(/置換前/, \"置換後\") }" |
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
#! ruby | |
# coins.sort.reverse! | |
def calc(sum, coins) | |
if coins.size == 1 | |
return (sum % coins[0] == 0) ? 1 : 0 | |
end | |
count = 0 | |
num = coins[0] |
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
#! ruby | |
sum = 30 | |
coins = [10, 5, 1] | |
coins.sort.reverse! | |
count = 0 | |
1.upto(sum) do |n| | |
count += coins.repeated_combination(n).count {|a| a.inject(:+) == sum } |
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
#! ruby | |
digits = 9 | |
ans = [] | |
(1..digits).to_a.permutation(digits) do |a| | |
0.upto(digits - 3) do |i| | |
i.upto(digits - 3) do |j| | |
x = a[0..i].join.to_i | |
y = a[(i + 1)..(j + 1)].join.to_i |
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
#! ruby | |
buns = [] | |
10.upto(99) do |i| | |
i.upto(99) do |j| | |
buns << [i, j] | |
end | |
end | |
results = [] |
OlderNewer