Skip to content

Instantly share code, notes, and snippets.

@rubencaro
Last active August 28, 2017 07:54
Show Gist options
  • Select an option

  • Save rubencaro/75e7b163665b47e0094a to your computer and use it in GitHub Desktop.

Select an option

Save rubencaro/75e7b163665b47e0094a to your computer and use it in GitHub Desktop.
DOT auto render script
function get_mtime {
ls -l --time-style=+%s "${1?}" | cut -d' ' -f6
}
function go_render {
dotfile="$1"
mtime=0
while true;
do
newtime=$(get_mtime "$dotfile")
test $mtime -ne $newtime && dot -O -Tpng $dotfile;
mtime=$newtime
sleep 1;
done;
}
go_render myfile.dot &
@RemiVR

RemiVR commented Jul 14, 2017

Copy link
Copy Markdown

Mac version of get_mtime:

function get_mtime {
  ls -l -T "${1?}" | cut -d' ' -f12
}

@RemiVR

RemiVR commented Jul 14, 2017

Copy link
Copy Markdown

Mac version of go_render:

function go_render {
 dotfile="$1"
 mtime=0
 while true;
 do
   newtime=$(get_mtime "$dotfile")
   test $mtime != $newtime && dot -O -Tpng $dotfile;
   mtime=$newtime
   sleep 1;
 done;
}

@nfuste

nfuste commented Aug 25, 2017

Copy link
Copy Markdown

NO TODOS LOS MAC SON IGUALES!!!

function get_mtime {
  ls -l -T "${1?}" | cut -d' ' -f10
}

@nfuste

nfuste commented Aug 28, 2017

Copy link
Copy Markdown

Mi comentario anterior lo escribió Rubén Caro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment