Skip to content

Instantly share code, notes, and snippets.

@valvallow
Created January 7, 2012 06:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save valvallow/1574000 to your computer and use it in GitHub Desktop.
Save valvallow/1574000 to your computer and use it in GitHub Desktop.
available-url
#!/usr/local/bin/gosh
(use rfc.http)
(use srfi-1)
(define (main args)
(let ((urls (remove (pa$ equal? "")
(string-split (port->string (current-input-port)) "\n"))))
(for-each print
(filter-map (^u (guard (ex (else (print u)))
(receive (status header body)
(http-get u "/")
(rlet1 ret (and (equal? status "200") u)
(with-output-to-port (current-error-port)
(^ _ (display (boolean ret))
(display ":")
(print u)))))))
urls))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment