π¦ A toolkit make your programmer life easier.
Inspired by Boop
# macOS Intel
curl -L https://github.com/cloudingcity/gool/releases/latest/download/gool_Darwin_x86_64.tar.gz | \
tar xz && sudo mv gool /usr/local/bin/
# macOS Apple Silicon
curl -L https://github.com/cloudingcity/gool/releases/latest/download/gool_Darwin_arm64.tar.gz | \
tar xz && sudo mv gool /usr/local/bin/
# Linux x86_64
curl -L https://github.com/cloudingcity/gool/releases/latest/download/gool_Linux_x86_64.tar.gz | \
tar xz && sudo mv gool /usr/local/bin/
# Or for a specific version:
curl -L https://github.com/cloudingcity/gool/releases/download/v1.0.0/gool_Darwin_x86_64.tar.gz | \
tar xz && sudo mv gool /usr/local/bin/brew install --cask cloudingcity/tap/goolNote: On macOS, you may see a security warning since the binary is not signed/notarized (I'm too poor for Apple's $99/year developer fee π). To bypass this:
- Go to System Preferences β Security & Privacy β General
- Click "Allow Anyway" next to the blocked app warning
- Or run:
sudo xattr -rd com.apple.quarantine /opt/homebrew/bin/gool
$ gool
βββββββ βββββββ βββββββ βββ
ββββββββ βββββββββββββββββββββ
βββ βββββββ ββββββ ββββββ
βββ ββββββ ββββββ ββββββ
βββββββββββββββββββββββββββββββββββ
βββββββ βββββββ βββββββ ββββββββ
/help for more information
ΚβΟβΚ β― /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 β― /ts2date 1516239022
2018-01-18T01:30:22Z
jwt-decode β―$ gool jwt-decode eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
{
"header": {
"alg": "HS256",
"typ": "JWT"
},
"payload": {
"sub": "1234567890",
"name": "John Doe",
"iat": 1516239022
},
"signature": "SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}| Command | Description |
|---|---|
| tsconv | Smart timestamp/date converter - auto-detects input type (default: show current time as both) |
| msconv | Smart millisecond timestamp/date converter (default: show current time as both) |
| ts2date | Covert unix timestamp to date (default: current time) |
| date2ts | Covert date to unix timestamp (default: current time) |
| 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 |
| uuid | Generate UUID v4 (default: 1) |
| count | Get the characters length |
| camel-case | Coverts string to camel case (fooBar) |
| kebab-case | Coverts string to kebab case (foo-bar) |
| lower-case | Coverts string to lower case (foo bar) |
| snake-case | Coverts string to snake case (foo_bar) |
| start-case | Coverts string to start case (Foo Bar) |
| upper-case | Coverts string to upper case (FOO BAR) |
| text-escape | Escape quotes and backslashes in text |
| text-unescape | Unescape quotes and backslashes in text (pretty prints JSON) |
| format-json | Cleans and format JSON |
package main
import (
"fmt"
"github.com/cloudingcity/gool/pkg/cases"
"github.com/cloudingcity/gool/pkg/date"
"github.com/cloudingcity/gool/pkg/text"
"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
fmt.Println(text.Escape(`{"key": "say "value""}`))
// {\"key\": \"say \"value\"\"}
fmt.Println(text.Unescape(`{\"key\": \"say \"value\"\"}`))
// {"key": "say "value""}
}Clouding π» |
LeoZhan π» |
Toby Lam π» |