over 5 years ago

有點晚看到這個,Git.io: GitHub URL Shortener。起因是從chef-hacking那邊看到有人在chatroom聊到這個,趕緊dig一下怎麼玩法,原來是這麼簡單!!!
就是curl的應用而已,太妙了。玩法如下:

  • 確認Repository的URL,copy paste下來 https://github.com/vlpeng/vlpeng.github.com
  • 趕緊打開TotalTerminal
  • 照著敲下面敲
  • 會得到:
    HTTP/1.1 100 Continue
    HTTP/1.1 201 Created
    Server: nginx/1.0.13
    X-Node: gitio2
    Content-Type: text/html;charset=utf-8
    Date: Thu, 05 Jul 2012 11:49:08 GMT
    Status: 201 Created
    X-Revision: ed12847ba41557297b8ae9c296008ba56920fa9a
    Location: http://git.io/SJ-SaQ
    X-Runtime: 0.006652
    Connection: keep-alive
    Content-Length: 0
  • Location的冒號後面就是短網址囉Yahooooooo。
  • 當然也可以反過來
  • 就會得到這樣
    HTTP/1.1 302 Found
    Server: nginx/1.0.13
    Date: Thu, 05 Jul 2012 11:51:38 GMT
    Content-Type: text/html;charset=utf-8
    Connection: keep-alive
    Status: 302 Found
    Location: https://github.com/vlpeng/vlpeng.github.com
    Content-Length: 0
    X-Runtime: 0.002789
    X-Node: gitio2
    X-Revision: ed12847ba41557297b8ae9c296008ba56920fa9a
  • 試試gist看看,也可以喔Yahoooooooooooo
    curl -i http://git.io -F "url=https://gist.github.com/3053260"
    HTTP/1.1 100 Continue
    HTTP/1.1 201 Created
    Server: nginx/1.0.13
    X-Node: gitio2
    Content-Type: text/html;charset=utf-8
    Date: Thu, 05 Jul 2012 11:53:13 GMT
    Status: 201 Created
    X-Revision: ed12847ba41557297b8ae9c296008ba56920fa9a
    Location: http://git.io/AMv5eg
    X-Runtime: 0.007890
    Connection: keep-alive
    Content-Length: 0
  • 如果這樣惡搞呢?當然就不行囉
    curl -i http://git.io -F "url=http://octopress.org/docs/blogging/"
    HTTP/1.1 100 Continue
    HTTP/1.1 422 Unprocessable Entity
    Server: nginx/1.0.13
    Date: Thu, 05 Jul 2012 11:55:18 GMT
    Content-Type: text/html;charset=utf-8
    Connection: keep-alive
    Status: 422 Unprocessable Entity
    Content-Length: 27
    X-Runtime: 0.000833
    X-Node: gitio2
    X-Revision: ed12847ba41557297b8ae9c296008ba56920fa9a
  • 一起歐森吧!!!!!
← Sublime Text與gist的完美結合 It's Time to Migrate to Logdown →