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
| // This code will return a deadlock error. | |
| // Since the channel c is unbuffered, the write operation c<-42 (writing 42 to the channel) will block. | |
| package main | |
| func main() { | |
| c := make(chan int) | |
| c <- 42 | |
| val := <-c | |
| println(val) |
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" | |
| "io/ioutil" | |
| "sort" | |
| "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
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| type Ball struct{ hits int } | |
| 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
| package main | |
| import ( | |
| "encoding/xml" | |
| "fmt" | |
| ) | |
| //<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> | |
| type Envelope struct { | |
| XMLName xml.Name `xml:"soap12:Envelope"` |
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
| built-in streaming replication | |
| http://repmgr.org/ | |
| http://slony.info/ :: http://pgfoundry.org/projects/skytools/ | |
| http://bucardo.org/ :: http://www.postgresql.org/docs/current/static/high-availability.html | |
| http://momjian.us/main/writings/pgsql/replication.pdf :: http://wiki.postgresql.org/wiki/Streaming_Replication | |
| http://wiki.postgresql.org/wiki/Binary_Replication_Tutorial :: http://repmgr.org/ | |
| http://www.postgresql.org/docs/current/static/warm-standby.html#SYNCHRONOUS-REPLICATION :: https://github.com/omniti-labs/mimeo | |
| https://wiki.postgresql.org/wiki/Replication%2C_Clustering%2C_and_Connection_Pooling#Replication | |
| http://www.slideshare.net/MasaoFujii/builtin-replication-in-postgresql |
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 ( | |
| "code.google.com/p/go-tour/tree" | |
| "fmt" | |
| ) | |
| // Walk walks the tree t sending all values | |
| // from the tree to the channel ch. | |
| func Walk(t *tree.Tree, ch chan int) { |
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 ( | |
| "errors" | |
| "html/template" | |
| "io/ioutil" | |
| "log" | |
| "net/http" | |
| "regexp" | |
| ) |
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" | |
| // The dumb way to deal with SOAP requests | |
| func userRequest(userId string) string { | |
| template := soapify(userTemplate) | |
| return fmt.Sprintf(template, userId) | |
| } |
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
| #! /usr/bin/env bash | |
| # | |
| # search [file(s)] | |
| # | |
| # This script will read the files passed as parameters and those files | |
| # will contain a list of IPs separated by lines and will search for | |
| # each of those IPs in both omg-switch log files | |
| # | |
| # When no argument is passed, it will open the page on the current branch |
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" | |
| func main() { | |
| primes := []int{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97} | |
| p := binarySearch(primes, 59) | |
| fmt.Println("O número 11 esta na posição ", p) | |
| } |