$ curl -o pspc16 https://dl.dropboxusercontent.com/u/856934/pspcl6
$ chmod +x pspc16
$ gem install snoop terminal-notifier
$ ruby why.rb
Last active
December 16, 2015 09:29
-
-
Save chrishunt/5413745 to your computer and use it in GitHub Desktop.
_why ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'snoop' | |
URL = 'http://whytheluckystiff.net' | |
def render(message) | |
unless File.exists? "#{message}.pdf" | |
`curl -o #{message} #{URL}/SPOOL/#{message} && \ | |
./pspc16 -o #{message}.pdf -sDEVICE=pdfwrite #{message} && \ | |
rm #{message}` | |
notify "_why: #{message}" | |
end | |
end | |
def notify(message) | |
puts message | |
`terminal-notifier -message "#{message}"` | |
end | |
Snoop::HttpNotifier.new(url: URL).notify while: -> { true }, delay: 300 do |c| | |
c.scan(/SPOOL\/(\w*)/).flatten.each { |message| render message } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TL;DR
What is it for ;)