Skip to content

Instantly share code, notes, and snippets.

@chrishunt
Last active December 16, 2015 09:29
Show Gist options
  • Save chrishunt/5413745 to your computer and use it in GitHub Desktop.
Save chrishunt/5413745 to your computer and use it in GitHub Desktop.
_why ?
$ curl -o pspc16 https://dl.dropboxusercontent.com/u/856934/pspcl6
$ chmod +x pspc16
$ gem install snoop terminal-notifier
$ ruby why.rb
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
Copy link

ghost commented Apr 20, 2013

TL;DR
What is it for ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment