-
Notifications
You must be signed in to change notification settings - Fork 52
/
remote
executable file
·59 lines (52 loc) · 1.68 KB
/
remote
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
#remote --- Functions For Remote -*- mode: sh; -*-
# Start a remote ssh session with reverse port forwarding
# usage: remote hostname speech-server $DTK_PROGRAM
# starts a local server, then ssh to remote-host,
# and set up reverse port forwarding.
# See https://hackertarget.com/ssh-examples-tunnels/ for ssh tunnel tips
#Examples:
# remote host.example.com speech-server outloud
# Configuration:
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SDIR=$DIR/../servers
# Primary server listens on 2222
# Notification server listens on 3333
#helper: chime
function chime () {
play -q -n -t alsa \
synth -j 3 sin %3 sin %-2 sin %-5 sin %-9 sin %-14 sin %-21 \
fade h .01 2 1.5 \
delay 1.3 1 .76 .54 .27 \
remix - \
fade h 0 2.7 2.5 norm -1 &
}
function remote () {
REMOTE=$1
SERVER=$2
ENGINE=$3
$SDIR/$SERVER 2222 $SDIR/$ENGINE &
#notification stream listens on 3333
(export ALSA_DEFAULT="tts_mono_left"; $SDIR/$SERVER 3333 $SDIR/$ENGINE &)
chime
# Open SSH Connection
ssh -R 2222:localhost:2222 -R 3333:localhost:3333 $REMOTE
}
#setup tts, but dont ssh.
#use when we need to restart server
# hard-wire speech-server and outloud; $remote not used
function rtts () {
SERVER=speech-server
ENGINE=outloud
$SDIR/$SERVER 2222 $SDIR/$ENGINE &
#notification stream listens on 3333
(export ALSA_DEFAULT="tts_mono_left"; $SDIR/$SERVER 3333 $SDIR/$ENGINE &)
chime
}
function rdtk () {
SERVER=speech-server
ENGINE=dtk-soft
$SDIR/$SERVER 2222 $SDIR/$ENGINE &
#notification stream listens on 3333
(export ALSA_DEFAULT="tts_mono_left"; $SDIR/$SERVER 3333 $SDIR/$ENGINE &)
chime
}