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
{ | |
"requiredArgs": [ | |
"where", | |
"command" | |
], | |
"optionalArgs": [ | |
"mutation-name" | |
], | |
"templates": [ | |
{ |
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
{ | |
"requiredArgs": [ | |
"where", | |
"command" | |
], | |
"optionalArgs": [ | |
"mutation-name" | |
], | |
"templates": [ | |
{ |
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
#!/bin/bash | |
vim /etc/docker/daemon.json | |
service docker restart | |
docker network create foo | |
docker network inspect foo | grep Subnet # "Subnet": "10.10.1.0/24" |
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" | |
"sync" | |
) | |
func makeResult(i int) string { | |
return fmt.Sprintf("this is %v", i) | |
} |
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
// https://golang.org/pkg/database/sql/#DB.SetMaxOpenConns | |
// Go's default setting is "unlimited" for SetMaxOpenConns() but PG's setting is 100. | |
// If you don't set a limit, go won't handle it in the application layer and never wait to open a new connection | |
// so it's possible to throw a "max connections" error. That's why you should set the limits, this can be a starting point | |
// for small and medium web applictions. | |
db.SetMaxOpenConns(25) | |
db.SetMaxIdleConns(25) | |
db.SetConnMaxLifetime(5*time.Minute) |
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
09:55 $ go run speedupfor.go | |
Using sum function: 64416925 | |
39.187µs | |
Using sumWG function: 64416925 | |
3.486436ms | |
Using sumChAndWG function: 64416925 | |
33.303102ms | |
Using sumAtomic function: 64416925 | |
2.848421ms | |
Using sumSelect function: 64416925 |
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" | |
"sync" | |
) | |
type Foo struct { | |
ID int | |
} |
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 ( | |
"encoding/json" | |
"fmt" | |
"reflect" | |
) | |
type User struct { | |
Permissions []string |
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" | |
"reflect" | |
) | |
type User struct { | |
Permissions []string | |
} |
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" | |
"time" | |
) | |
func main() { | |
now := time.Now() |
NewerOlder