Skip to content

Instantly share code, notes, and snippets.

@orymate
Last active August 29, 2015 14:27
Show Gist options
  • Save orymate/402427fcfa318305861d to your computer and use it in GitHub Desktop.
Save orymate/402427fcfa318305861d to your computer and use it in GitHub Desktop.
vnc wall (minőségi szolgáltatás)
service beep
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/local/bin/beep.sh
server_args = -l 400
disable = no
}
#!/bin/bash
/usr/bin/beep "$@"
mkdir -p /tmp/tv
chmod 777 /tmp/tv
touch /tmp/tv/beep
import os
from bottle import route, run, template, request
@route('/', method='GET')
def index():
ip = request.environ.get('REMOTE_ADDR')
return template('''<!DOCTYPE html><form action="" method="POST"><input type="submit" value="csatlakozas {{ip}}:0-hoz"/></form>
<p>Ilyen kell hozza:<br><code>x11vnc -viewonly -clip xinerama0</code>
<h1>daily</h1>
<form action="/daily" method="POST"><input type="submit" value="daily"/></form>
''',
ip=ip)
@route('/', method='POST')
def index():
ip = request.environ.get('REMOTE_ADDR')
os.system("killall vncviewer; vncviewer {} -Shared=1 -ViewOnly=1 -FullScreen=1 &".format(ip))
return '<!DOCTYPE html>indul a buli!'
@route('/daily', method='POST')
def index():
with open("/tmp/tv/daily", "w"):
pass
return '''<!DOCTYPE html><h1>daily</h1>
<div id="mycounter"></div>
<script>
i = 900;
function t(){
document.getElementById('mycounter').innerHTML = ((i/60)>>0) + ":" + i%60;
i--;
if (i < 0) {
document.location = "/";
document.getElementById('mycounter').innerHTML = "Vege";
}
else {
setTimeout(t, 1000);
}
}
t()
</script>'''
run(host='0.0.0.0', port=8080)
#!/bin/bash -x
mkdir -p /tmp/tv
while true
do
if [ -f /tmp/tv/beep ]
then
rm /tmp/tv/beep
xdotool getactivewindow key --clearmodifiers CTRL+2 # zabbix
xdotool getactivewindow key --clearmodifiers CTRL+R
elif [ -f /tmp/tv/daily ]
then
xdotool getactivewindow key --clearmodifiers CTRL+1 # jira story board
find /tmp/tv/daily -mmin +15 -delete -print | grep . && /usr/bin/beep
else
xdotool getactivewindow key --clearmodifiers CTRL+Tab
fi
inotifywait /tmp/tv -t 20
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment