Skip to content

Instantly share code, notes, and snippets.

@izawa
Created February 20, 2014 09:11
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 izawa/9109720 to your computer and use it in GitHub Desktop.
Save izawa/9109720 to your computer and use it in GitHub Desktop.
t.co url -> regular url replacer function
;; t.co -> regular url replacer
(defun untco ()
(interactive)
(let ((tco (buffer-substring (region-beginning) (region-end))))
(setq resolv (replace-regexp-in-string "\n+$" "" (shell-command-to-string (format "curl -s -I %s |awk \'$1~/[lL]ocation/{print $2}\'" tco))))
(if (> (length resolv) 0)
(progn
(kill-region (region-beginning) (region-end))
(insert resolv)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment