Giter VIP home page Giter VIP logo

rizzy's Introduction

rizzy

All in a tizzy over timestamps? rizzy is a UNIX filter that will convert UTC timestamps into the timestamp of your choosing.

Example

Before:

$ cat some.log.file
2021-09-17 17:28:07+0000 INFO Running on slurm - limited math CPU usage by a SLURM_CPUS_ON_NODE of 3
2021-09-17 17:30:12+0000 INFO Initializing Environment. Using Environment.V5_C_PROD

After:

$ cat some.log.file | rizzy --chi
2021-09-17T12:28:07-05:00 INFO Running on slurm - limited math CPU usage by a SLURM_CPUS_ON_NODE of 3
2021-09-17T12:30:12-05:00 INFO Initializing Environment. Using Environment.V5_C_PROD

Flags

Running rizzy --help gives more information, but basically:

  • use --chi for Chicago and --nyc for New York
  • for other zones use --zone ...
  • To output in other formats than RFC3339 use --format
  • To optionally treat big numbers encountered as nanos-since-epoch, use --convert-epoch-nanos

Building and running

  • Grab rustup - either from the website or by sudo snap install rustup --classic.
  • Install the stable rust version: rustup install stable
  • Build the code with cargo build, or run with cargo run

Making a release

  • Bump the version in Cargo.toml
  • Run cargo build and cargo test to make sure everything's working and to ensure the Cargo.toml gets updated.
  • Commit!
  • Push and make sure all's well
  • Tag the version with vXX.YY/ZZ
  • Push the tag (git push --tags) which should kick things off automatically!
  • Make sure all's well and then mark the release as current in GitHub (with some helpful explanation)

rizzy's People

Contributors

siedentop avatar mattgodbolt avatar

Stargazers

Dave Proffer avatar Rajiv Patel-O'Connor avatar Nissi Nassime avatar  avatar  avatar Raviteja V Guttula avatar Erik Engstrom avatar Daniel Dugovic avatar Patrick Servello avatar Haroldo de Oliveira Pinheiro avatar

Watchers

Ben Rady avatar Lyle Hayhurst avatar  avatar Dave Proffer avatar

rizzy's Issues

rizzy -n doesn't handle large negative value

% echo '-9223372036854775808' | rizzy -n
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: PosOverflow }', src/rizzy.rs:77:69
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
% echo '-9223372036854775807' | rizzy -n
-2262-04-11T17:47:16.854775807-06:00
% rizzy --version
rizzy 0.1.1

Rust Format

Thanks for this neat little utility!

Would it be possible for you to run Rust Format (rustfmt) on the code. This would make it more fun to contribute to your code.

If you prefer, you could enforce future compliance through the GitHub Actions.

This example suggests doing it this way:

      - uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: --all -- --check

Better `panic` handling

I'm not sure what the rust-y way to do this is but when I typo a timezone, this seems pretty nasty:

$ rizzy --zone not_a_tz
thread 'main' panicked at 'Could not parse timezone: not_a_tz, Error: 'not_a_tz' is not a valid timezone', src/main.rs:45:19
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Consider building statically

We use rizzy as an easy-copyable binary at Aquatic. That works as we all agree on the Ubuntu version:

$ ldd target/release/rizzy
	linux-vdso.so.1 (0x00007ffd83470000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f040597e000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f0405776000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0405557000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0405353000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0404f62000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f04061cf000)

It might be worth looking at building a musl static build which ends up with a 7MB static binary.

$ rustup target add x86_64-unknown-linux-musl
$ cargo build --release --target x86_64-unknown-linux-musl
$ ls -hld target/x86_64-unknown-linux-musl/release/rizzy
-rwxrwxr-x 2 mgodbolt mgodbolt 7.0M Feb  3 19:27 target/x86_64-unknown-linux-musl/release/rizzy
$ ldd target/x86_64-unknown-linux-musl/release/rizzy
	not a dynamic executable

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.