#!/usr/bin/env ruby
module PARS_CONF
def get_conf(conf_file)
if File::ftype(conf_file) == "file"
return Array[*open(conf_file).read.split(/(\n|\r)/).map{|f|
f.split(/\r/)
}.flatten]
end
end
def ldif_conf(conf_file)
if File::ftype(conf_file) == "file"
return get_conf(conf_file).select{|b|
b =~ /(^uid\:[[:blank:]]|^mail\:[[:blank:]])/
}.each{|x|
x.gsub!(/(^uid\:[[:blank:]]|^mail\:[[:blank:]])/,"")
}
end
end
def running_conf(conf_file)
if File::ftype(conf_file) == "file"
return get_conf(conf_file).select{|b|
b =~ /(^user[[:blank:]]|^[[:blank:]]*description[[:blank:]].*@.*)/}.each{|x|
x.gsub!(/(^user[[:blank:]]|^[[:blank:]]*description[[:blank:]])/,"")
}
end
end
def aliases_get(conf_file)
if File::ftype(conf_file) == "file"
return Array[*open(conf_file).read.split(/((^\s*)(:|,)(\s*)$)/).map{|f|
f.gsub!(/(^\#.*$\n)|(\\$\n)|([[:blank:]]*)/,"") ;f.split(/\n/)}.flatten]
end
end
protected :get_conf
protected :ldif_conf
protected :running_conf
protected :aliases_get
def get_ac(conf_file)
if File::ftype(conf_file) == "file"
case File::extname(conf_file)
when /(ldif|LDIF|ldap|LDAP)/
return ldif_conf(conf_file).sort
when /(cli|CLI)/
return running_conf(conf_file).sort
when /ali/
return aliases_get(conf_file).sort
else
return get_conf(conf_file).sort
end
end
end
end
class COMP_AC
include PARS_CONF
def initialize(file1, file2)
@A1 = get_ac(file1)
@A2 = get_ac(file2)
end
def show_comp()
printf("%s only,\t%s only\n" ,ARGV[0],ARGV[1])
a = [(@A1 - @A2).sort, (@A2 - @A1).sort]
if a[0].length > a[1].length
count = a[0].length
a[1].fill(a[1].length ,count) { nil }
elsif a[0].length < a[1].length
count = a[1].length
a[0].fill(a[0].length , count) { nil }
else
count = a[0].length
end
i = 0
while i < count
printf("\"%s\",\"%s\"\n",a[0][i],a[1][i])
i += 1
end
end
end
if ARGV[0].nil? or ARGV[1].nil? then
print < out.csv
EOS
elsif ARGV.size > 0 then
COMP_AC.new(ARGV[0], ARGV[1]).show_comp
end
3/10/2011
memo
Subscribe to:
Post Comments (Atom)
WSKY Bluetooth 5.0 トランスミッター レシーバー買いました
安くレシーバーモードでapt-x HDが使えるものというと非常に限られますが そのなかで高音質と評判のよかったものをということで購入しました。 音質は安いなりですね、apt-x HDで接続されている状態でも元がなんであれ痩せた音になります。 SBSにしか対応していない...
-
特に確認もせず買って来たもののドライバもないし 刺しただけではきちんと動かない 一応動作させることはできたが・・・ チップはRTL8811AUらしいのだが、そのチップ名でドライバを探しても正常に動くものは見つからない とりあえず認識して通信ができたドライバはこちら ...
-
発狂しそうだった件 以下を参考に実施 http://www.xpenology.nl/hp-n40ln54l-bios-modificatie-2013-10-01/ http://homeservershow.com/forums/index.php?/topic/4...
-
安くレシーバーモードでapt-x HDが使えるものというと非常に限られますが そのなかで高音質と評判のよかったものをということで購入しました。 音質は安いなりですね、apt-x HDで接続されている状態でも元がなんであれ痩せた音になります。 SBSにしか対応していない...
No comments:
Post a Comment