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 | |
# ------------------------------------------------- | |
# Make site directory | |
# Download WP and install WP to site directory | |
# Set WP configuration | |
# Configure NGINX for new domain-name | |
# ------------------------------------------------- | |
# apt-get update |
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 | |
# README | |
# -------------------- | |
# chmod u+x django_init.sh | |
# ./django_init.sh my-super-project.com main | |
# -------------------- | |
SETTINGS_APP="core" |
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 ( | |
"strings" | |
"testing" | |
"time" | |
) | |
func timeIntToString(val int) string { | |
switch val { |
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
// lout | |
log.Debugf("-------- $VAR$: %#v", $VAR$)$END$ | |
// sout | |
fmt.Printf("------- rmn123 $VAR$: %+v\n", $VAR$)$END$ | |
// fout | |
fmt.Println("$VAR$") | |
// ii |
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 ( | |
"log" | |
"net/http" | |
) | |
// go run main.go | |
// | |
// $ curl "http://127.0.0.1:8090" |
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
go test -bench=. -benchmem | |
BenchmarkRedisSet-8 1526 802456 ns/op 249 B/op 9 allocs/op | |
BenchmarkRedisGet-8 1552 818410 ns/op 196 B/op 7 allocs/op | |
BenchmarkEtcdSet-8 80 27729002 ns/op 14010 B/op 124 allocs/op | |
BenchmarkEtcdGet-8 9590 125109 ns/op 7070 B/op 125 allocs/op |
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 ( | |
"context" | |
"fmt" | |
"log" | |
"time" | |
"github.com/go-redis/redis" | |
clientv3 "go.etcd.io/etcd/client/v3" |
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 ( | |
"context" | |
"fmt" | |
"log" | |
"testing" | |
) | |
// go test -bench=. -benchmem |
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
go mod tidy | |
go run main.go | |
# etcd is great |
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" | |
clientv3 "go.etcd.io/etcd/client/v3" | |
) | |
func NewEtcdClient() (*clientv3.Client, error) { | |
cl, err := clientv3.New(clientv3.Config{ | |
Endpoints: []string{"localhost:2379"}, |
NewerOlder