Skip to content

Latest commit

 

History

History
137 lines (110 loc) · 6.13 KB

README.md

File metadata and controls

137 lines (110 loc) · 6.13 KB

Gool

Test Lint Deploy codecov Go Report Card

📦 A toolkit make your programmer life easier.

Inspired by Boop

demo

Installation

Homebrew

brew install cloudingcity/tap/gool

Docker

docker run --rm -it ghost0436/gool

Usage

$ gool jwt-decode eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
{
  "header": {
    "alg": "HS256",
    "typ": "JWT"
  },
  "payload": {
    "sub": "1234567890",
    "name": "John Doe",
    "iat": 1516239022
  },
  "signature": "SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}

Gool Shell

$ gool shell 
Gool Shell
\h: show help
=# \s jwt-decode
jwt-decode=# eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
{
  "header": {
    "alg": "HS256",
    "typ": "JWT"
  },
  "payload": {
    "sub": "1234567890",
    "name": "John Doe",
    "iat": 1516239022
  },
  "signature": "SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
jwt-decode=#

Scripts

Script Description
timestamp-to-date, t2d Covert unix timestamp to date
date-to-timestamp, d2t Covert date to unix timestamp
jwt-decode Decode JWT
md5 Computes the checksum
url-encode Encode url
url-decode Decode url
url-to-json Convert url to JSON
base64-encode Base64 encode
base64-decode Base64 decode
rand-string Generate random string of given length (characters: a-z, A-Z, 0-9)
count Get the characters length
camel-case Coverts string to camel case
kebab-case Coverts string to kebab case
lower-case Coverts string to lower case
snake-case Coverts string to snake case
start-case Coverts string to start case
upper-case Coverts string to upper case
format-json Cleans and format JSON

Library

package main

import (
	"fmt"

	"github.com/cloudingcity/gool/pkg/cases"
	"github.com/cloudingcity/gool/pkg/date"
	"github.com/cloudingcity/gool/pkg/timestamp"
)

func main() {
	fmt.Println(cases.Snake("HelloWorld"))
	// hello_world

	fmt.Println(cases.Camel("hello world"))
	// helloWorld

	fmt.Println(date.ToTimestamp("2020-09-01"))
	// 1598918400 <nil>
	
	fmt.Println(timestamp.ToDate(1598918400))
	// 2020-09-01 08:00:00 +0800 CST
}

Contributors


Clouding

💻

LeoZhan

💻

Toby Lam

💻