POST /new
Content-Type: application/json
<description>
(title, time, memory, source, input, output, sample_input, sample_output)
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
package main | |
import ( | |
"net/http" | |
) | |
func handleGet(w http.ResponseWriter, req *http.Request) { | |
w.WriteHeader(200) | |
w.Write([]byte("Hello World")) | |
} |
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
#!/usr/bin/env ruby | |
require 'qiniu-rs' | |
Qiniu::RS.establish_connection! :access_key => 'access key', | |
:secret_key => 'secret key' | |
bucket_name = 'test963' | |
token = Qiniu::RS.generate_upload_token :scope => bucket_name, | |
:expires_in => 3600 |
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
package main | |
import ( | |
"fmt" | |
"crypto/aes" | |
"crypto/cipher" | |
"encoding/hex" | |
"path/filepath" | |
"io/ioutil" | |
"os" |
内部的依赖关系可以设计为一个任务保存一个rely number,然后完成一个任务去把所有依赖它的任务的rely number减一,遇到零则该任务进入队列,重复直至所有任务完成。
Authorization
加密的时候加密内容为: <uri>\n<body>
// 上传任务
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
func SetTimeout(client *Client, t int) (err error) { | |
timeout := time.Duration(t) * time.Second | |
dialTimeout := func(network, addr string) (net.Conn, error) { | |
return net.DialTimeout(network, addr, timeout) | |
} | |
if client.Transport == nil { | |
client.Transport = &http.Transport{ | |
Dial: dialTimeout, |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"strings" | |
"time" | |
) | |
var ( |
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
package main | |
import ( | |
"fmt" | |
"net" | |
) | |
func main() { | |
ln, err := net.Listen("tcp", ":8080") |
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
package main | |
import ( | |
"runtime/debug" | |
"time" | |
) | |
func main() { | |
m := int64(1024*1024) * 100 |