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" | |
| "log" | |
| "strconv" | |
| "github.com/miekg/dns" | |
| ) |
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
| # make sure you have these installed | |
| yum install -y make gcc perl pcre-devel zlib-devel |
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
| //生成随机字符串 | |
| func RandStr(strlen int) string { | |
| rand.Seed(time.Now().Unix()) | |
| data := make([]byte, strlen) | |
| var num int | |
| for i := 0; i < strlen; i++ { | |
| num = rand.Intn(57) + 65 | |
| for { | |
| if num>90 && num<97 { | |
| num = rand.Intn(57) + 65 |
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
| #!/bin/sh | |
| # | |
| # Use posixregex CLI tool from: https://github.com/syzdek/dmstools/blob/master/src/posixregex.c | |
| RE_IPV4="((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])" | |
| posixregex -r "^(${RE_IPV4})$" \ | |
| 127.0.0.1 \ | |
| 10.0.0.1 \ | |
| 192.168.1.1 \ |
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
| Backup | |
| > mongodump --db db_name /backup_path/ | |
| > mongodump --db db_name --collection collection_name /backup_path/ | |
| Restore | |
| > mongorestore --db db_name /backup_folder/ |
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 ( | |
| "bufio" | |
| "log" | |
| "net/rpc" | |
| "os" | |
| ) | |
| func main() { |