原创 Golang1.7.3發送大附件郵件

package main import ( "bytes" "crypto/tls" "encoding/base64" "errors" "fmt" "io" "mime

原创 分享一個運維過程中的用的命令集合

代碼有點多放在git上面了 Install: go install -ldflags "-s -w" github.com/czxichen/wstools Wstools Usage: wstools [argu

原创 Golang1.7.3實現啓動單一實例代碼片段

var ( NameMutex = "Shamem" kernel = syscall.NewLazyDLL("kernel32.dll") ) const ( IPC_RMID = 0

原创 Go1.7.3簡單的ftp協議交互

package main import ( "bufio" "bytes" "errors" "fmt" "io" "log" "net" "os" "st

原创 Golang1.7.3使用標準庫的AES加密解密不實用擴展協議

package main import ( "crypto/aes" "crypto/cipher" "fmt" ) type tobytes struct { cip cipher.B

原创 Go1.7.3運維文件夾比較工具,可以支持遠程比較

package main import ( "bufio" "bytes" "crypto/md5" "encoding/hex" "errors" "flag" "fmt

原创 Go1.7.3一個收發消息的小接口

package transport import ( "encoding/binary" "errors" "io" "math" "sync" ) const ( sizeLe

原创 Go1.8從文件結尾讀取文件

package main import ( "bufio" "bytes" "flag" "io" "log" "os" "strconv" "sync" ) c

原创 Golang1.7.4標準庫sql使用

package main import ( "database/sql" "errors" "fmt" "net" "sync/atomic" "time" "githu

原创 golang1.8使用cgo獲取進程是否假死

package main import ( "flag" ) /* #include <stdio.h> #include <windows.h> #include <Winuser.h> typedef struct

原创 Go1.8操作Windows硬盤小實例

package main // #include <stdlib.h> import "C" import ( "bytes" "errors" "os" "syscall" "unsa

原创 Golang1.8編譯靜態庫給C使用

Go實例代碼: package main import ( "fmt" ) import "C" //export Printf func Printf(format, str string) { fmt.P

原创 Go1.8實現watchdog功能,實現依賴啓動服務程序

package main import ( "flag" "fmt" "log" "os" "os/signal" "os/user" "path" "strcon

原创 Go1.9 tcpproxy代理小實現

package main import ( "io" "log" "net" "strings" "sync" "time" ) func main() {} type rem

原创 Golang1.7.3使用x509標準庫創建自簽名證書和簽發名其他證書

主代碼: package rsa import ( "crypto/rand" "crypto/rsa" "crypto/x509" "crypto/x509/pkix" "encodin