Skip to content

Instantly share code, notes, and snippets.

@zeptometer
Created December 11, 2016 10:47
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 zeptometer/cd37ecaefb6305d3f2bdeb129593c252 to your computer and use it in GitHub Desktop.
Save zeptometer/cd37ecaefb6305d3f2bdeb129593c252 to your computer and use it in GitHub Desktop.
(eval-when (:compile-toplevel :load-toplevel :execute)
(defun script-p ()
(eql sb-sys:*stdin* *standard-input*)) )
(macrolet ((optimize (pred)
(if pred
`(declaim (optimize (speed 3) (debug 0) (safety 0)))
`(declaim (optimize (speed 0) (debug 3) (safety 3))))))
(optimize #.(script-p)))
(defun xclip ()
(with-output-to-string (s)
(sb-ext:run-program "/usr/bin/xclip" '("-o") :output s)))
(defun test ()
(with-input-from-string (*standard-input* (xclip))
(main)))
(defun main ()
;; write something here
)
(when (script-p) (main))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment