summaryrefslogtreecommitdiff
path: root/Biz/Que/Quescripts.md
blob: fe0c3dc56818c81b006f30c9bf8cc8bedc628775 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
% Quescripts

## Remote desktop notifications

Lets say we are running a job that takes a long time, maybe we are
compiling or running a large test suite. Instead of watching the
terminal until it completes, or flipping back to check on it every so
often, we can create a listener that displays a popup notification when
the job finishes.

In one terminal run the listener:

    que pub/notify --then "notify-send '{que}' '{msg}'"

In some other terminal run the job that takes forever:

    runtests ; que pub/notify - <<< "tests are done"

When terminal 2 succeeds, terminal 1 will print "tests are done", then
call the `notify-send` command, which displays a notification toast in
Linux with title "`pub/notify`" and content "`tests are done`".

Que paths are multi-producer and multi-consumer, so you can add as many
terminals as you want.

### On macOS

On macOS you could use something like this (just watch your quotes):

    osascript -e "display notification '{msg}' with title '{que}'"

in place of notify-send.

### With twilio-cli

Or, if you want SMS notifications, you can use
[twilio-cli](https://www.twilio.com/docs/twilio-cli/quickstart):

    que pub/notify --then "twilio api:core:messages:create --from <phone1> --to <phone2> --body '{que}: {msg}'"

I personally have this running at all times on my desktop so I can walk away
from a long-running job, and as long as I have my phone with me, I will know
when it completes.

## Ephemeral, serverless chat rooms

coming soon

## Collaborative jukebox

It's surprisingly easy to make a collaborative jukebox.

First start up a music player:

    que --poll pub/music --then "playsong '{msg}'"

where `playsong` is a script that plays a file from data streaming to
`stdin`. For example [vlc](https://www.videolan.org/vlc/) does this when
you run it like `vlc -`.

Then, anyone can submit songs with:

    que pub/music song.mp3