-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.go
102 lines (87 loc) · 1.73 KB
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package main
import (
"bufio"
"fmt"
"net"
"os"
)
func main(){
conn , _ := net.Dial("tcp","127.0.0.1:8080")
reader := bufio.NewReader(os.Stdin)
fmt.Printf("Text to send: ")
text,_ := reader.ReadString('\n')
fmt.Println(text)
if conn != nil{
fmt.Fprintf(conn,text+"\n")
msg,_ := bufio.NewReader(conn).ReadString('\n')
fmt.Printf("Message from server :%s",msg)
}
}
func firstMissingPositive(nums []int) int {
neg := 0
for i , _ := range nums{
if v <= 0 {
swap(&nums[neg] , &nums[i])
neg++
}
}
for i, v := range nums[neg:]{
if v < 0 {
v = v*-1
}
if v <= len(nums[neg:]){
nums[v-1] = nums[v-1] * -1
}
}
fmt.Println(nums)
}
func swap( a *int , b *int) {
*a ,*b = *b ,*a
}
// 3 4 -1 1
// 0 1 2 3
// -1 -4 3 -1
// 0 1 2 3
// 7 8 9 11 12
// 0 1 2 3 4
// 0 ->
// -2-3 -4 8 3 2 3 4 5 6 7
// 0 1 2 3 4 5 6 7 8 9 10
// 1 2 3 4 5 6 7 8
curl -X DELETE 127.0.0.1:7201/api/v1/services/m3db/namespace/default
curl -X POST http://localhost:7201/api/v1/database/create -d '{
"namespaceName": "default",
"type": "cluster",
"numShards": 64,
"replicationFactor": 3,
"retentionTime": "240h",
"blockSize": {
"time": "2h"
},
"hosts": [
{
"id": "m3dbnode-0",
"zone": "embedded",
"isolationGroup": "ig-0",
"weight": 100,
"address": "m3dbnode-0.m3dbnode",
"port": 9000
},
{
"id": "m3dbnode-1",
"zone": "embedded",
"isolationGroup": "ig-1",
"weight": 100,
"address": "m3dbnode-1.m3dbnode",
"port": 9000
},
{
"id": "m3dbnode-2",
"zone": "embedded",
"isolationGroup": "ig-2",
"weight": 100,
"address": "m3dbnode-2.m3dbnode",
"port": 9000
}
]
}' | jq .