float= The Red Rook (cover).png

Parallel Visions: City of Angels City of Demons ebook and trade paperback available on Amazon (or here).
The question of whether Vance was dead or not became more than academic when he found himself in a bathtub up to his chin in ice water like some forgotten cocktail garnish, a demonic woman standing over him, and no memory of how he got there.
Read free chapters of Parallel Visions: City of Angels City of Demons here
The Red Rook, sequel to Dispensing Justice and the second novel of Nova Genesis World is now available for Kindle or as a paperback at Amazon.
Read free chapters of Dispensing Justice here (or get it here).
Read free chapters of The Red Rook here (or get it here). -- Fritz Freiheit

Dispensing Justice (cover).png 20th Annual Writer's Digest Self-Published Book Awards - Honorable Mention.png

Sandbox ruby

From FritzWiki
Jump to: navigation, search


wget -O target.zip from_link
file_name = gzip -list target.zip
gzip -d target.zip
mv file_name new_file_name

@error_links = []
@errors = []

def get_and_rename_file( link:, new_file_name: )
 `wget -O target.zip #{link}`
 file_name = `gzip -list target.zip`
 file_name.chomp!
 `gzip -d target.zip`
 `mv #{file_name} #{new_file_name}`
rescue Exception => e
  @error_links << link
  # @errors << "#{e.class} #{e.message} at #{e.backtrace[0..5].join("\n")}"
  @errors << "#{e.class} #{e.message} at #{e.backtrace[0]}"
end

def report_errors
  puts
  puts "Errors"
  @errors.each_with_index |error,index|
    puts "==================================="
    puts "Error link: #{@error_links[index]}"
    puts error
    puts 
  end
end

# format for input file:
#sample_file_name<tab>link

def load_link_file
  list_of_arrs = []
  # loop over lines of file
  # open file
  # loop over lines
    if line =~ /^(.+)\t(.+)$/
      new_file_name = Regexp.last_match( 1 ).strip
      link = Regexp.last_match( 2 ).strip
      arr = [ link, "#{new_file_name}.fastq" ]
      list_of_arrs << arr
    end
  end
  list_of_arrs
end

@list_of_links = load_link_file # format [ [ "link1", "sample1" ], [ "link2", "sample2" ] ]

@list_of_links.each do |arr|
 get_and_rename_file( link: arr[0], sample_number: arr[1] )
end

report_errors