So this writes out the frequency of all nucleotides at the first and second position in a fastq formatted file. You need to install the bio-faster package. This can be done by as follows:

sudo gem install bio-faster
sudo gem update bio

You can use input as a gnu zipped file. Call it like

zcat test.fastq.gz | ruby fastq_reader.rb

Now for the script.

#!/usr/bin/env ruby
require 'bio'
require 'bio-faster'
include Bio
ary_bp1 =
ary_bp2 =
counts_bp1 =
counts_bp2 =
fastq = # if stdin then you can pipe output from zcat -ex) zcat test.fastq.gz | ruby fastq_reader.rb
fastq.each_record do |sequence_header, sequence, quality|
  seq =
  ary_bp1 << sequence[0]
  ary_bp2 << sequence[1]
ary_bp1.each { |base| counts_bp1[base] += 1 }
ary_bp2.each { |base| counts_bp2[base] += 1 }
puts counts_bp1
puts counts_bp2