Guest User

gdocs-viewer.sh

a guest
Sep 29th, 2015
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.35 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
  4.  
  5. ({ echo -ne "HTTP/1.0 200 OK\r\nContent-Type:application/octet-stream\r\nContent-Disposition:attachment\r\nContent-Length: $(wc -c < "$1")\r\n\r\n"; cat "$1"; } | nc -w 2 -l -p 1234 2>&1 > /dev/null) &
  6.  
  7. xdg-open "http://docs.google.com/viewer?url=http://$IP:1234/$(basename "$1")"
Advertisement
Add Comment
Please, Sign In to add comment