Git Product home page Git Product logo

jr's Introduction

JR: streaming Quality Random Data from the Command line

JR is a CLI program that helps you to stream quality random data for your applications.

jr

img.png Build Build License: MIT Go Reference Docker Hub

JR-simple

Documentation

For full documentation about emitters, referential integrity, how to write templates and more, pls see the full JR Documentation.

Building and compiling

JR requires Go 1.20

you can use the make_install.sh to install JR. This script does everything needed in one simple command.

./make_install.sh

These are the steps in the make_install.sh script if you want to use them separately:

make all
make copy_templates
sudo make install

If you want to run the Unit tests, you have a make target for that too:

make test

Basic usage

JR is very straightforward to use. Here are some examples:

Listing existing templates

jr template list

Templates are in the directory $HOME/.jr/templates. You can override with the --templatePath command flag Templates with parsing issues are showed in red, Templates with no parsing issues are showed in green

Create random data from one of the provided templates

Use for example the predefined net_device template to generate a random JSON network device

jr template run net_device

or, with a shortcut:

jr run net_device

Using Docker

You can also use a Docker Hub image if you prefer.

docker run -it ugol/jr:latest jr run net_device

Other options for templates

If you want to use your own template, you can:

  • put it in the default directory
  • embed it directly in the command using the --embedded flag

For a quick and dirty test, the best option is to embed directly a template in the command:

jr run --template "name:{{name}}"

Create more random data

Using -n option you can create more data in each pass. This example creates 3 net_device objects at once:

jr run net_device -n 3

Continuous streaming data

Using --frequency option you can repeat the creation every f milliseconds

This example creates 2 net_device every second, for ever:

jr run net_device -n 2 -f 1s 

Using --duration option you can time bound the entire object creation.

This example creates 2 net_device every 100ms for 1 minute:

jr run net_device -n 2 -f 100ms -d 1m 

Results are by default written on standard out (--output "stdout") with this output template:

"{{.V}}\n"

which means that only the "Value" is in the output. You can change this behaviour embedding a different template with --outputTemplate

If you want syntax colouring and your output is just json, you can pipe to jq

jr run net_device -n 2 -f 100ms -d 1m | jq

Beware that if you, for example, include the key in the output, it won't be possible to use jq:

jr run net_device -n 2 -f 100ms -d 1m --kcat | jq

parse error: Expected value before ',' at line 1, column 5

jr's People

Contributors

ugol avatar hifly81 avatar eljeko avatar gianlucanatali avatar foogaro avatar sdellang avatar ram-pi 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.