juntaki
7/20/2016 - 10:52 AM

binread.rb

require "gnuplot"
require "fftw3"

io = File.open("/bin/bash", "rb")

test = io.read(500000)
test.size                       # => 500000
y =  test.unpack("S!*")
x = [*0..y.size]
Gnuplot.open do |gp|
  Gnuplot::Plot.new( gp ) do |plot|

    plot.xrange "[0:10000]"#{x.size}]"
    plot.yrange "[0:7000]"

    plot.data << Gnuplot::DataSet.new( [x,y] ) do |ds|
      ds.with = "points"
      ds.notitle
    end
  end
end

# >> writing this to gnuplot:
# >> set xrange [0:10000]
# >> set yrange [0:7000]