Skip to content

Instantly share code, notes, and snippets.

@redperadot
Created July 31, 2014 19:51
Show Gist options
  • Select an option

  • Save redperadot/e6231470ff78b5aea494 to your computer and use it in GitHub Desktop.

Select an option

Save redperadot/e6231470ff78b5aea494 to your computer and use it in GitHub Desktop.

Revisions

  1. Cody Hannafon created this gist Jul 31, 2014.
    22 changes: 22 additions & 0 deletions vtplayer.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    #!/usr/bin/env ruby
    #
    # vtplayer.rb - A simple script to play vt100 animations.
    # Made with ❤︎ by [email protected] - v0.1
    #
    # Some places to find vt100 animations:
    # http://artscene.textfiles.com/vt100/
    # http://www.scovetta.com/archives/textfiles/art

    require 'open-uri'
    Signal.trap("INT") { puts; exit 0 }
    abort("[Error] Need a file to play. Give the path of a remote or local file as an argument.") if ARGV[0].nil?

    path = ARGV[0]
    file = ( path[0,4] == 'http' ? open(path).read : IO.read(path) )

    $stdout.sync = true
    file.each_char do |char|
    print char
    sleep 0.0005
    end
    puts