Skip to content

Instantly share code, notes, and snippets.

@lillypad
Created March 3, 2019 21:14
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 lillypad/3345cfc1821fe2e8c75ccb92928d69f8 to your computer and use it in GitHub Desktop.
Save lillypad/3345cfc1821fe2e8c75ccb92928d69f8 to your computer and use it in GitHub Desktop.
(load "~/quicklisp/setup.lisp")
(ql:quickload :drakma :silent t)
(ql:quickload :cl-json :silent t)
(defmacro drakma-http-request (url &rest body)
`(map 'string 'code-char (drakma:http-request, url ,@body)))
(defun get-public-ip()
(cdr (assoc :ip
(json:decode-json-from-string
(drakma-http-request "http://ipinfo.io"
:user-agent "curl")))))
(defun main()
(format t "~a~%" (get-public-ip)))
(main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment