ens-ulm-1-2015

google hashcode 2015 source for team ens-ulm-1
git clone https://a3nm.net/git/ens-ulm-1-2015/
Log | Files | Refs

commit 76c4bd3454a579355551fd8265ce7e4e0a09ab68
parent ce6ed930ab0af18d07869fbee1ae7a8229e2ea22
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sat, 28 Mar 2015 16:02:07 +0100

shell

Diffstat:
contest/a3nm/run.sh | 5+++++
contest/a3nm/runtillbetter.sh | 21+++++++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/contest/a3nm/run.sh b/contest/a3nm/run.sh @@ -0,0 +1,5 @@ +scp input $1:$2 +ssh "$1" +cd "$2" +./runtillbetter.sh $3 $4 + diff --git a/contest/a3nm/runtillbetter.sh b/contest/a3nm/runtillbetter.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +touch output$2 +(./a.out "$1" <(sed 1d input) output$2 < final_round.in >&2) & +PID=$! +head -1 output$2 > head1$2 +while true; +do + inotifywait -e MODIFY output$2 >/dev/null 2>/dev/null + head -1 output$2 > head1b$2 + if diff head1$2 head1b$2 > /dev/null + then + echo nop >&2 + else + echo OK >&2 + break + fi +done +kill $PID +cat output$2 +