View dockerctl.sh
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
#!/usr/bin/env bash | |
cids=`docker ps -a | awk 'FNR>1 {print $1}'` | |
function stop() { | |
for v in $cids | |
do | |
echo "stop "$v | |
docker stop $v | |
done |
View redis-sub-pub-golang-demo.go
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" | |
"log" | |
"time" | |
"gopkg.in/redis.v2" | |
) |
View mongodb-multi-collection-query-by-go.go
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
// import ( | |
// "fmt" | |
// "time" | |
// | |
// mgo "gopkg.in/mgo.v2" | |
// "gopkg.in/mgo.v2/bson" | |
// ) | |
// ``` cmd in mongo shell | |
// db.Slot.aggregate([ |
View adding-version.go
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 ( | |
"flag" | |
"os" | |
"strings" | |
) | |
var ( | |
Version = "1.0.0" |
View mergesort.go
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 ( | |
"sync" | |
) | |
const parallelBySliceLength = 1 << 10 * 3 | |
func MergeSortLoop(src []int64) { | |
srcReadOnly := make([]int64, len(src))//update only in merge stage |
View leaderByEtcd.go
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 demo | |
import ( | |
"context" | |
"log" | |
"math/rand" | |
"path" | |
"time" | |
clientv3 "github.com/coreos/etcd/clientv3" |
View qps-rate-limiting.go
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 ( | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" | |
"time" |
View es-mapping-date-detect-issue.sh
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
#!/usr/bin/env bash | |
getAddr() | |
{ | |
cat <<EOF | |
http://elastic:Qnzs2020@172.26.50.105:9230 | |
EOF | |
} | |
# curl -XDELETE "$(getAddr)/mappingdetectdemo?pretty" |
View go.mod
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
module rtpdemo | |
go 1.18 | |
require ( | |
github.com/go-audio/audio v1.0.0 | |
github.com/go-audio/wav v1.1.0 | |
github.com/jart/gosip v0.0.0-20220818224804-29801cedf805 | |
github.com/linnv/logx v1.3.5 | |
github.com/zaf/g711 v0.0.0-20220109202201-cf0017bf0359 |
View rabbitmq-demo.go
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 ( | |
"flag" | |
"fmt" | |
"log" | |
"strconv" | |
"time" | |
"github.com/streadway/amqp" |