Git Product home page Git Product logo

dt's Introduction

Build Status Go Report

dt - the dev toolbelt

The dev toolbelt is a fast and flexible cli tool to handle common use cases of your daily work. Use cases you generally use some online tools.

Table of Contents

Example

Installation

If you've go installed and your $GOPATH is set, you can easily install dt with:

go get github.com/chclaus/dt

Install via Homebrew

brew tap chclaus/dt [email protected]:chclaus/dt.git
brew install dt

Install via Docker

docker pull chclaus/dt:latest
docker run --rm chclaus/dt:latest version

Shell completions

If you installed the tool via homebrew and use either bash or zsh as shell, you don't need to worry about anything else.

If you used the native installation, you can easily create an autocompletion:

Bash

Write bash completion code to a file and source if from .bash_profile:

dt completion --shell bash > ~/.dt_completion.sh
printf "\n# dt bash completion\nsource '$HOME/.dt_completion.sh'" >> $HOME/.bash_profile
source $HOME/.bash_profile

Zsh

Set the dt completion code for zsh to autoload on startup:

dt completion --shell zsh > "${fpath[1]}/_dt"

Build

To build the project you can clone the repository with...

git clone [email protected]:chclaus/dt

... and build and install the binary with

cd dt && go install

Build with Docker

To build the repository with docker, do the following:

git clone [email protected]:chclaus/dt
cd dt
docker build -t dt .
docker run --rm dt version

Commands

URI command

  • Encodes an URI to a safe representation
  • Decodes an already encoded URI

Base64 command

  • Encodes a string to it's base64 representation
  • Decodes a base64 string to it's plain representation

The base64 command can be used with different encodings:

  • Standard, follows RFC 4648
  • Standard Raw, follows RFC 4648 but with without padding
  • URL, follows the alternative RFC 4648
  • URL Raw, follows the alternative RFC 4648 but with without padding

Hash command

Returns the hash representation of an input in different hash formats:

  • md5
  • sha1
  • sha256
  • sha3_256
  • sha3_512
  • sha512
  • bcrypt

UUID command

Returns a new random UUID. You can specify the generated UUID version:

  • Version 1, based on timestamp and MAC address (RFC 4122)
  • Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1)
  • Version 3, based on MD5 hashing of (namespace(UUID), value) (RFC 4122)
  • Version 4, based on random numbers (RFC 4122)
  • Version 5, based on SHA1 hashing of (namespace(UUID), value) (RFC 4122)

JWT command

Decodes a jwt and pretty prints the resulting json. You can also pass a secret (base64 or plain) within a file or as program argument to verify the jwt signature.

Random command

Generates random strings and numbers. Currently supported functions are:

  • Generates a random string, based on an alphabet with a specific length.
  • Generates a random string with alphanumeric letters.
  • Generates a random string with a alphanumeric and special characters.
  • Generates random numbers with a specific length.

Date command

Date conversions:

  • time millis to RFC 3339
  • time nanos to RFC 3339
  • RFC 3339 to time millis

HTML command

Escapes and unescapes HTML

  • transforms a string to an escaped html sequence
  • reads a file and prints an escaped html sequence
  • unescapes an escaped html sequence to it's raw representation

Server

Starts a simple web server to serve static content. You can specify hostname and port and must set a folder to serve.

You can also pass an option -o to open your default system browser that points automatically to the served url.

Configuration

You can configure a some default behaviors of dt to fit your needs. Just place a file .dt.yaml into your home directory, you can configure the following options:

server:
  port: 3001
  address: 127.0.0.1
  openBrowser: true
uuid:
  namespace: cacae610-c76a-4736-90ef-0271126b4346
  version: 4
base64:
  encoding: std
random:
  algorithm: complex
  length: 20
hash:
  algorithm: bcrypt
  cost: 12
jwt:
  secret: foobar
  secretFile: /path/to/your/secret/file
  base64Secret: false

For more informations, please take a look in the examples directory.

Contributing

Everyone is welcome to create pull requests for this project. If you're new to github, take a look here to get an idea of it.

If you've got an idea of a function that should find it's way into this project, but you won't implement it by yourself, please create a new issue.

Please ensure, that all contributions match the MIT license.

License

dt (dev-toolbelt) is released under the MIT license. See LICENSE.txt

dt's People

Contributors

chclaus avatar goreleaserbot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.