common tools for golang

utils

common tools for golang

package main

import (
	"github.com/daqnext/utils/bytes_util"
	"github.com/daqnext/utils/color_util"
	"github.com/daqnext/utils/hash_util"
	"github.com/daqnext/utils/ip_util"
	"github.com/daqnext/utils/path_util"
	"github.com/daqnext/utils/rand_util"
	"github.com/daqnext/utils/runtime_util"
	"github.com/daqnext/utils/time_util"
)

func main() {

	color_util.ColorPrintln(color_util.Yellow, time_util.GetUTCDate())
	color_util.ColorPrintln(color_util.Yellow, time_util.GetUTCDateTime())
	color_util.ColorPrintln(color_util.Red, bytes_util.Format(12312341344))
	color_util.ColorPrintln(color_util.Green, rand_util.GenRandStr(80))
	color_util.ColorPrintln(color_util.Red, runtime_util.StackString(100))
	color_util.ColorPrintln(color_util.Green, hash_util.MD5Hash_String("1234214"))
	color_util.ColorPrintln(color_util.Green, hash_util.MD5Hash_StringArray([]string{"123", "1234"}))
	color_util.ColorPrintln(color_util.Green, hash_util.MD5Hash_StringArray([]string{}))
	color_util.ColorPrintln(color_util.Green, hash_util.MD5Hash_String(""))
	color_util.ColorPrintln(color_util.Green, path_util.GetAbsPath("/subfolder/subsubfolder"))
	color_util.ColorPrintln(color_util.Green, path_util.GetAbsPath("/subfolder/xxx.json"))
	path_util.ExEPathPrintln()

	bytesnum, err := bytes_util.Parse("11.47TB") //case insensitive
	if err != nil {
		color_util.ColorPrintln(color_util.Red, err.Error())
	} else {
		color_util.ColorPrintln(color_util.Green, bytesnum)
	}

	ipstr, iperr := ip_util.GetPubIp(false)
	if iperr != nil {
		color_util.ColorPrintln(color_util.Red, iperr)
	} else {
		color_util.ColorPrintln(color_util.Blue, ipstr)
	}

}


Similar Resources

gopkg is a universal utility collection for Go, it complements offerings such as Boost, Better std, Cloud tools.

gopkg is a universal utility collection for Go, it complements offerings such as Boost, Better std, Cloud tools. Table of Contents Introduction

Jan 5, 2023

Little Bug Bounty & Hacking Tools⚔️

Little Bug Bounty & Hacking Tools ⚔️

Jan 7, 2023

Source code of Liteloader Tools

LiteLoader Tools This repository store the source code of some LiteLoader Tools Prebuilt Binary see /bin folder Image2Binary [Golang] convert Image(jp

Aug 30, 2022

Go tools sourcecode read and customize

Go Tools This subrepository holds the source for various packages and tools that support the Go programming language. Some of the tools, godoc and vet

Oct 24, 2021

A fully Go userland with Linux bootloaders! u-root can create a one-binary root file system (initramfs) containing a busybox-like set of tools written in Go.

u-root Description u-root embodies four different projects. Go versions of many standard Linux tools, such as ls, cp, or shutdown. See cmds/core for m

Dec 29, 2022

Mackerel SLI/SLO tools

shimesaba For SRE to operate and monitor services using Mackerel. Description shimesaba is a tool for tracking SLO/ErrorBudget using Mackerel as an SL

Nov 21, 2022

Like tools/cmd/stringer with bitmask features

Bitmasker Bitmasker is a tool used to automate the creation of helper methods when dealing with bitmask-type constant flags. Given the name of an unsi

Nov 25, 2021

Functional tools in Go 1.18 using newly introduced generics

functools functools is a simple Go library that brings you your favourite functi

Dec 5, 2022

Generic-based collection tools

go-collection go collection is a tool implemented using generic, it can help you process slice/map data quickly and easily convert between them. Note:

Dec 29, 2022
Related tags
sigurls is a reconnaissance tool, it fetches URLs from AlienVault's OTX, Common Crawl, URLScan, Github and the Wayback Machine.

sigurls is a reconnaissance tool, it fetches URLs from AlienVault's OTX, Common Crawl, URLScan, Github and the Wayback Machine. DiSCLAIMER: fe

May 22, 2021
a decision & trigger framework backed by Google's Common Expression Language used in graphikDB

a decision & trigger framework backed by Google's Common Expression Language used in graphikDB

Nov 15, 2022
The one-stop shop for most common Go functions
The one-stop shop for most common Go functions

Pandati The one stop shop for most common Go functions Table of contents Pandati The one stop shop for most common Go functions Table of contents Purp

Mar 21, 2022
redis-util business-friendly encapsulation of redis operations, such as the common cache set get operation

redis-util 方便业务使用的redis操作封装,比如常见的缓存set get操作, 一行代码搞定,不像开源库需要写好多行 使用方法

Oct 22, 2021
Common utils that need in every development

Utils modules Common utils that need in every development Modules Conversion String IntToString(num int) string Int8ToString(num int8) string Int16ToS

Nov 5, 2021
With Pasteback you can store common terms and paste them back to clipboard

Pasteback With Pasteback you can store common terms and paste them back to clipboard when needed. There is one central spot to put every string into y

Nov 22, 2021
Helper functions for common scenarios, using Go generics.

zeroflucs generics When writing Go code for Go 1.17 or below, we've all written more than our fair share of methods to check "does this slice contain

Feb 18, 2022
Code generation tools for Go.

interfaces Code generation tools for Go's interfaces. Tools available in this repository: cmd/interfacer cmd/structer cmd/interfacer Generates an inte

Dec 23, 2022
A directory of hardware related libs, tools, and tutorials for Go

Go + hardware This repo is a directory of tools, packages and tutorials to let you introduce Go in your hardware projects. Why Go? Go can target platf

Dec 30, 2022
gqlanalysis makes easy to develop static analysis tools for GraphQL in Go.
gqlanalysis makes easy to develop static analysis tools for GraphQL in Go.

gqlanalysis gqlanalysis defines the interface between a modular static analysis for GraphQL in Go. gqlanalysis is inspired by go/analysis. gqlanalysis

Dec 14, 2022