Giter Site home page Giter Site logo

f-trigger's Introduction

๐‘“-trigger

Trigger events based on a frequency on stdin

Examples

cycling_cadence.py | f-trigger \
    0 "play break_song.ogg" \
    1-80 "play easy_song.ogg" \
    81- "play pumping_song.ogg"
tail -f /var/log/mybot.log | f-trigger \
    -10 "echo 'Low activity. Notifying administrator.'; email_admin.sh"
tail -f /var/log/apache2/error.log | f-trigger 10000- "play alert.ogg"

f-trigger's People

Contributors

xordspar0 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

f-trigger's Issues

Split off a `bpm` command

f-trigger should be more generic. It should trigger based on streams of numbers coming from stdin. Instead of calculating the frequency of input, there should be a companion command called bpm that converts stdin to a bpm value. f-trigger will then use that number to trigger its events. The syntax of f-trigger commands need not change.

Example:

tail -f /var/log/apache2/errors.log | bpm | f-trigger 10000- "play alert.ogg"

f-trigger will now take a stream of numbers as input. This allows us to more easily add some features. Ideas:

  • store recent values and calculate moving averages
  • optionally ignore large, sudden spikes
  • set a default value for when there is no input

Add a visual output mode

With the -v flag, output will look something like this:

program.sh | f-trigger -v 0 "do_something.sh" 1-20 "another_thing.sh" 20-40 "one_more_thing.sh"
11      => 0       1-20    20-40
 ^                 ^
Current            Since this is the current action,
 input              highlight it with reverse video.

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.