Skip to content

snakehopper/goutil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goutil

crypto

var h = HashUtils{Key: k}
cipherText := h.Encrypt(plainText)
fmt.Println(h.HasMatch(plainText, cipherText))

Output: true

user

var d = "0234"
var vd = NewValidateDigit(s)
fmt.Println(vd.HasMatch("234"))

Output: true

os

Some( most ) related function wrapper from linux environment

GetPsAuxCount = ps aux | grep xx | wc -l

IsFreeMemoryLessThanMB = cat /proc/meminfo | grep MemFree

eff_bytesize

ref

fmt.Println(ByteSize(1), ByteSize(10), ByteSize(1000), ByteSize(1024))

Output: 1.00B 10.00B 1000.00B 1.00KB

fmt.Println(2.5*MB, ByteSize(1e13), 1*MB==1024*KB)

Output: 2.50MB 9.09TB true

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages