go 语言模拟百度登录

go 语言模拟百度登录

go 语言模拟百度登录1.参考网上Python的例子自己写了一个go语言的。这个仅供学习技术参考,为了方便有部分参数直接phantomjs执行js获取,代码基本都有注释,测试打印没有删除,还请见谅!2.本文参考http://blog.csdn.net/qiye_/article/details/52884491话不多说,直接上码package main import ( "errors" "fmt" "math/big" "crypto/rsa" "byt...

Goland 2020-10-26 PM 1725℃ 0条
goland 获取unix时间

goland 获取unix时间

//获取unix时间 func getMillisecond() int64{ MS := time.Now().Unix() return MS }

Goland 2020-10-26 PM 1422℃ 0条
mysql 按日期统计

mysql 按日期统计

mysql 按日期统计按年汇总,统计:select sum(mymoney) as totalmoney, count(*) as sheets from mytable group by date_format(col, '%Y');按月汇总,统计: select sum(mymoney) as totalmoney, count(*) as sheets from mytable group by date_format(col, '%Y-%m');按季度汇总,统计: select sum(mymoney) as totalmoney,count(*) as sheets from ...

数据库 2020-10-26 PM 1567℃ 0条
sendcloud golang 发送短信 示例代码

sendcloud golang 发送短信 示例代码

package main import ( "fmt" "crypto/md5" "encoding/hex" "sort" "strings" "net/url" "bytes" "net/http" "io/ioutil" ) var urls = "http://www.sendcloud.net/smsapi/s...

Goland 2020-10-26 PM 1741℃ 0条
go 生成32位md5字串

go 生成32位md5字串

package main import ( "crypto/md5" "encoding/hex" "fmt" ) //生成32位md5字串 func Md5(s string) string { h := md5.New() h.Write([]byte(s)) return hex.EncodeToString(h.Sum(nil)) } func main() { fmt.Println(Md5("cmdRe")) }

Goland 2020-10-26 PM 2489℃ 0条
Go Windows 执行CMD出现中文乱码的解决方法

Go Windows 执行CMD出现中文乱码的解决方法

package main import ( "bufio" "fmt" "golang.org/x/text/encoding/simplifiedchinese" "os/exec" ) type Charset string const ( UTF8 = Charset("UTF-8") GB18030 = Charset("GB18030") ) func main() { command :=...

Goland 2020-10-26 PM 3726℃ 0条
Golang 中三种读取文件发放性能对比

Golang 中三种读取文件发放性能对比

 Golang 中读取文件大概有三种方法,分别为:    1. 通过原生态 io 包中的 read 方法进行读取    2. 通过 io/ioutil 包提供的 read 方法进行读取    3. 通过 bufio 包提供的 read 方法进行读取  下面通过代码来验证这三种方式的读取性能,并总结出我们平时应该使用的方案,以便我们可以写出最优代码:package main import ( "os" "io" "bufio" "io/ioutil" "tim...

Goland 2020-10-26 PM 1539℃ 0条
GoLand 实现中文拼音排序

GoLand 实现中文拼音排序

package main import ( "bytes" "fmt" "golang.org/x/text/encoding/simplifiedchinese" "golang.org/x/text/transform" "io/ioutil" "sort" ) //ByPinyin is customized sort interface to sort string by Chinese PinYin type...

Goland 2020-10-26 PM 1426℃ 0条
Golang中文乱码问题

Golang中文乱码问题

在学习golang读取文件的过程中,遇到中文显示乱码的问题!golang没有自带的编解码包,因此需要借助第三方包解决方法:引入第三发转码包:git clone https://github.com/axgle/mahonia.git接下来直接上代码:package main import ( "bufio" "fmt" "io" "mahonia" //编码转换 "os" ) func main() { var enc mahonia.Decod...

Goland 2020-10-26 PM 1370℃ 0条
golang 编码转换 gbk

golang 编码转换 gbk

package main import ( "fmt" "io/ioutil" "os" "golang.org/x/text/transform" "golang.org/x/text/encoding/simplifiedchinese" ) func main() { f, err := os.Open("C:\\Users\\sherl\\Desktop\\11.txt") if err != ni...

Goland 2020-10-26 PM 1528℃ 0条
go语言中文字符串数组排序

go语言中文字符串数组排序

package main import ( "bytes" "fmt" "io/ioutil" "sort" "golang.org/x/text/encoding/simplifiedchinese" "golang.org/x/text/transform" ) //ByPinyin is customized sort interface to sort string by Chinese PinYin typ...

Goland 2020-10-26 PM 1544℃ 0条