|
Server IP : 161.35.85.9 / Your IP : 216.73.217.134 Web Server : nginx/1.30.1 System : Linux cheapdeb-ams3 7.0.9+deb14-amd64 #1 SMP PREEMPT_DYNAMIC Debian 7.0.9-1 (2026-05-22) x86_64 User : root ( 0) PHP Version : 8.2.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /bin/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
#!/usr/bin/ruby
$q ||= false
$g ||= false
require 'rubygems'
require 'ruby_parser'
require 'pp'
good = bad = 0
multi = ARGV.size != 1
total_time = 0
total_loc = 0
total_kbytes = 0
times = {}
locs = {}
kbytes = {}
begin
time = (ENV["RP_TIMEOUT"] || 10).to_i
ARGV.each do |file|
rp = RubyParser.new
loc = `wc -l #{file}`.strip.to_i
size = `wc -c #{file}`.strip.to_i / 1024.0
locs[file] = loc
kbytes[file] = size
total_loc += loc
total_kbytes += size
if $q then
$stderr.print "."
else
warn "# file = #{file} loc = #{loc}"
end
GC.start if $g
t = Time.now
begin
begin
rp.reset
r = rp.process(File.binread(file), file, time)
pp r unless $q
good += 1
rescue SyntaxError => e
warn "SyntaxError for #{file}: #{e.message}"
bad += 1
end
rescue => e
warn "#{e.backtrace.first} #{e.inspect.gsub(/\n/, ' ')} for #{file}"
warn " #{e.backtrace.join("\n ")}"
bad += 1
end
t = Time.now - t
times[file] = t
total_time += t
end
rescue Interrupt
# do nothing
end
warn "done"
total = 0
times.values.each do |t|
total += t
end
puts
puts "good = #{good} bad = #{bad}" if multi
puts
format = "%5.2fs:%9.2f l/s:%8.2f Kb/s:%5d Kb:%5d loc:%s"
times.sort_by { |f, t| -t }.each do |f, t|
next if t < 0.005
loc = locs[f]
size = kbytes[f]
puts format % [t, loc / t, size / t, size, loc, f]
end
puts
puts format % [total_time,
total_loc / total_time,
total_kbytes / total_time,
total_kbytes,
total_loc,
"TOTAL"] unless total_time == 0