Skip to content

Instantly share code, notes, and snippets.

@timabell
Last active July 27, 2020 13:57
Show Gist options
  • Save timabell/da08616ecb8693d524b8eab3b7b51018 to your computer and use it in GitHub Desktop.
Save timabell/da08616ecb8693d524b8eab3b7b51018 to your computer and use it in GitHub Desktop.
live reloading graphviz editing
sudo apt install graphviz entr
digraph {
a -> b
a -> c
b -> d
c -> d
}
<html>
<head>
<!-- https://stackoverflow.com/questions/1346716/how-do-i-make-firefox-auto-refresh-on-file-change/6385846#6385846 -->
<script type="text/javascript" src="http://livejs.com/live.js"></script>
</head>
<body>
<img src="out.svg"/>
</body>
</html>
#!/bin/bash
file=${1:-graph.gv}
echo "showing rendering of $file"
dot -Tsvg "$file" > out.svg && xdg-open out.svg
#!/bin/sh -v
./update.sh "$1"
./watch.sh "$1" &
xdg-open http://localhost:8000/live-graph.html &
python -m SimpleHTTPServer
wait
#!/bin/bash
file=${1:-graph.gv}
echo "updating rendering of $file"
date
dot -Tsvg "$file" > out.svg
touch live-graph.html # to trigger live.js
echo updated
#!/bin/bash
# https://github.com/guard/guard/wiki/Guard-alternatives
# http://eradman.com/entrproject/
file=${1:-graph.gv}
echo "watching $file"
echo "$file" | entr ./update.sh "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment