自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

JieLinDee的专栏

天道酬勤,厚积薄发.对Go语言有兴趣的朋友可以加:259693140(已满),858980110(02群),进群不允许

  • 博客(20)
  • 收藏
  • 关注

原创 关于go语言中http做服务器使用正则的实例

package mainimport ( "net/http" "regexp")func main() { http.HandleFunc("/", route) http.ListenAndServe(":8080", nil)}var num = regexp.MustCompile(`\d`)var str = regexp.MustCompile(`\s`)

2015-05-30 14:59:59 3193

原创 Go语言smtp模块发纯文本文件

package mainimport ( "fmt" "net/smtp")func main() { auth := smtp.PlainAuth("text/plain", "[email protected]", "123456", "smtp.163.com") to := []string{"[email protected]"} msg := []byte(`To:12345

2015-05-22 15:53:27 1552

原创 Go语言ssh群发linux命令

闲着没事搞了小程序,在Window上面往linux机器上群发命令,写的不好欢迎大家指正,还有就是用此工具发送恶意命令的人请离开,编译了一份64_Window和linux的程序,供大家参考使用,Rm_tmp_cmd.exe 在win下面提供使用!我的目录结构:flagparse      --------flag.goGetconf      --------getc

2015-05-22 12:46:56 2247 4

原创 python写个进程监控的脚本

废话不多说了,直接贴代码,大家配置文件都是喜欢用xml我不太喜欢,下面这个是自定义配置文件:class_config.py#!/usr/bin/env python#coding:utf-8'''此处定义邮件的相关参数'''class Mail_conf(): sender = '[email protected]' receiver = 'fyxichen@12

2015-05-21 13:26:09 4770

原创 Go语言单元测试

package ceimport ( "crypto/md5" "math/rand")func getmd5(s []byte) []byte { md := md5.New() md.Write(s) x := md.Sum([]byte("")) return x}func T() string { name := rangdom_string() x :=

2015-05-20 13:41:08 841

原创 go语言结构体定义使用

package mainimport ( "fmt" "sync")type Info struct { info map[int]string mu sync.RWMutex}func main() { x := &Info{info: make(map[int]string)} x.Set(1, "golang

2015-05-20 11:21:38 2271

原创 python中系统信息获取psutil使用

#!/usr/bin/env python#coding:utf-8import psutilimport timeimport sysfrom optparse import OptionParserparser = OptionParser() parser.add_option("-t", "--time", dest="time", he

2015-05-20 08:54:35 2069

原创 Go语言Mysql简单使用.

查询:package mainimport ( "database/sql" "fmt" _ "github.com/go-sql-driver/mysql" "time")func main() { con, _ := sql.Open("mysql", "root:123456@tcp(localhost:3316)/mysql") defer con

2015-05-18 11:41:39 1246

原创 Go语言的gob简单使用

编码结构体:package mainimport ( "encoding/gob" "fmt" "os")func main() { info := map[string]string{ "name": "xichen", "age": "24", } name := "test.gob" File, _ := os.OpenFile(name, os.O_R

2015-05-15 10:45:04 2684

原创 Golang简单的template使用

1、简单实例package mainimport ( "os" "text/template")func main() { const xichen = `Hello World {{.}}` M := template.New("") M.Parse(di) M.Execute(os.Stdout, "曦晨")}2、循环使用package mainimp

2015-05-15 09:07:39 2923

原创 Go语言爬取网站磁力链接

package mainimport ( "bufio" "fmt" "io" "io/ioutil" "net/http" "os" "regexp" "strconv" "strings" "time")func main() { fmt.Print("输入要查询的字符:") reader := bufio.NewReader(os.Stdin) input

2015-05-14 17:11:27 3060

原创 Go语言冒泡排序

package mainimport ( "fmt")func main() { A := []int{5, 21, 2, 4, 1} num := len(A) for i := 0; i < num; i++ { for j := i + 1; j < num; j++ { if A[i] > A[j] { A[i], A[j] = A[j], A[i]

2015-05-14 15:48:13 442

原创 Go语言panic和recover使用

package mainimport ( "fmt")func main() { f() fmt.Println("Returned normally from f.")}func f() { defer func() { if r := recover(); r != nil { fmt.Println("R

2015-05-11 11:28:16 1343

原创 Go语言标准库Json的使用.

GitHub上别人做的封装,挺好用的,推荐一下:https://github.com/bitly/go-simplejson这个内置的标准库用起来还是很烦得,要知道对方发过来的type,不然只能自己分析反射.package mainimport ( "encoding/json" "fmt")type Status_slice [][]inttype Info str

2015-05-07 20:56:26 1514

原创 Go语言周边常用命令积累

https://code.google.com/p/go-wiki/wiki/Projects Go语言开源项目$ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build    Linux下面编译命令$ CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build    Linux下面编译命令

2015-05-06 17:23:07 1067

转载 关于Go语言手动管理内存的见解

Go 语言是自带GC的, 相对C语言等的手动内存管理省事很多, 弊端便是会消耗更多的内存, 以及在GC时导致整个程序的停顿. 在某些特殊场合, 如果能够可选地手动进行内存管理, 效果会好不少.Go 目前的 GC 实现比较简单(mark-sweep算法), 进程的内存使用量取决于两次GC操作直接的内存申请量(不能重复使用), 而且通常GC发生在函数调用的深处, 大量对象无法立即释放. 另外,

2015-05-06 17:14:46 1617

原创 Golang使用Gui简单实例

package mainimport ( "ui")func main() { go ui.Do(gui) if err := ui.Go(); err != nil { print(err.Error()) }}func gui() { newControl := ui.Space() w := ui.Ne

2015-05-06 16:21:59 1744 2

原创 Go语言ssh简单的使用

package mainimport ( "bufio" "go-ssh/ssh" "os")func main() { SSH("user", "password", "ip_port")}func SSH(user, password, ip_port string) { PassWd := []ssh.AuthMethod{ssh.Password(password

2015-05-06 08:25:29 3506

原创 Go语言使用Scp传输文件

package mainimport ( "fmt" "go-ssh/ssh" "io" "os")const ( user = "user" ip_port = "ip_port" password = "Passwd")func main() { PassWd := []ssh.AuthMethod{ssh.Password(password)} C

2015-05-05 09:26:29 5740

原创 Go语言目录压缩,"archive/zip","path/filepath"

关于"path/filepath"和"archive/zip"使用

2015-05-05 08:54:43 1487

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除