Created
February 20, 2014 09:11
-
-
Save izawa/9109720 to your computer and use it in GitHub Desktop.
t.co url -> regular url replacer function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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