This file contains hidden or 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
| ## Building Blockchain in Go | |
| https://jeiwan.cc/posts/building-blockchain-in-go-part-1/ | |
| https://github.com/Jeiwan/blockchain_go | |
| ## Code your own blockchain in less than 200 lines of Go! |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <curl/curl.h> | |
| int main(void) | |
| { | |
| CURL *curl; | |
| CURLcode res; | |
| /* In windows, this will init the winsock stuff */ | |
| curl_global_init(CURL_GLOBAL_ALL); |
This file contains hidden or 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 ( | |
| "flag" | |
| "log" | |
| "net/http" | |
| "strings" | |
| ) | |
| func main() { |
This file contains hidden or 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
| FROM gliderlabs/alpine | |
| RUN apk add --update git build-base linux-headers wget tar perl zlib zlib-dev bzip2 bzip2-dev && \ | |
| cd /tmp && \ | |
| wget https://gflags.googlecode.com/files/gflags-2.0-no-svn-files.tar.gz && \ | |
| tar -xzvf gflags-2.0-no-svn-files.tar.gz && \ | |
| cd gflags-2.0 && \ | |
| ./configure && make && make install && \ | |
| cd /tmp && \ | |
| wget https://snappy.googlecode.com/files/snappy-1.1.1.tar.gz && \ |
This file contains hidden or 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" | |
| "syscall" | |
| ) | |
| type DiskStatus struct { | |
| All uint64 `json:"all"` | |
| Used uint64 `json:"used"` |
This file contains hidden or 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
| out, err := exec.Command("bash", "-c", "ps cax | grep myapp").Output() |
This file contains hidden or 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
| // v2 of the great example of SSE in go by @ismasan. | |
| // includes fixes: | |
| // * infinite loop ending in panic | |
| // * closing a client twice | |
| // * potentially blocked listen() from closing a connection during multiplex step. | |
| package main | |
| import ( | |
| "fmt" | |
| "log" |
This file contains hidden or 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
| // v2 of the great example of SSE in go by @ismasan. | |
| // includes fixes: | |
| // * infinite loop ending in panic | |
| // * closing a client twice | |
| // * potentially blocked listen() from closing a connection during multiplex step. | |
| package main | |
| import ( | |
| "fmt" | |
| "log" |
This file contains hidden or 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
| http { | |
| include mime.types; | |
| default_type application/octet-stream; | |
| sendfile on; | |
| keepalive_timeout 65; | |
| upstream myappget { | |
| server 127.0.0.1:3000; |
This file contains hidden or 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
| 1 普通匹配,遵循最长匹配规则,假设一个请求匹配到了两个普通规则,则选择匹配长度大的那个 | |
| 例如: | |
| location /{ | |
| [matches] | |
| } | |
| location /test{ | |
| [matches] | |
| } | |
| 2 精确匹配 | |
| location = /{ |