Code Monkey home page Code Monkey logo

gil_beats's Introduction

gil_beats

This command-line program deals with the Swatch Internet Time.

Features:

  • calculates the current @beats
  • supports @beats to H:m:s time format
  • outputs in several formats:
    • Bitbar/Xbar/Swiftbar
    • JSON
    • raw text

It's also usable in other Rust programs as a library.

CLI examples

Supports several output formats:

$ gil_beats
@469

$ gil_beats --format=json
{"beats":469,"time":"11:15:21"}

$ gil_beats --format=swiftbar
@469
---
11:15:21 | href=https://www.timeanddate.com/worldclock/fixedtime.html?day=6&month=11&year=2021&beats=469&p1=0

Beats to time:

$ gil_beats --beats 500 --format json
{"beats":500,"time":"12:00:00"}

History

One day, after we had been given an hour (change from summer time to winter time, daylight saving time (DST)), there was a small discussion on Twitter about when the European Union would finally implement its plans to abolish daylight saving time.

Someone mentioned Swatch Internet Time, a time-zone-less time format from 1998. The idea was unsuccessful.

Unimpressed by all this, I thought a program that will help me deal with the Internet Time could be a nice little project to invest the hour well and learn some Rust. Here it is.

Since I have no intention of making it a full-fledged crate, and due to lack of name-finding creativity, I have prefixed the obvious name beats with my first name and hence called it gil_beats.

Usage & Development

  1. Install Rust (e.g. rustup, via your version manager or brew install rust or which method you prefer)
  2. git clone https://github.com/gildesmarais/gil_beats.git and cd into it
  3. To run: cargo run -- --help
  4. To install: cargo install --path ., check for warnings and act, eventually run it: gil_beats

Use with Bitbar/XBar/Swiftbar...

To have the current @beats displayed in your menu bar, use:

and install gil_beats (see instructions above). Then, create this script in your *bar plugins folder, called e.g. gil_beats.87s.sh:

#!/bin/sh

"$HOME/.cargo/bin/gil_beats" --format=swiftbar

# or:
# gil_beats --format=swiftbar

Finally, chmod +x gil_beats.87s.sh and a new item on your menu bar should appear.

gil_beats's People

Contributors

dependabot[bot] avatar gildesmarais avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gil_beats's Issues

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.