Skip to content

Instantly share code, notes, and snippets.

@lotka
Created August 21, 2016 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lotka/52aa24eb088f61da69615a485322f554 to your computer and use it in GitHub Desktop.
Save lotka/52aa24eb088f61da69615a485322f554 to your computer and use it in GitHub Desktop.
watcher
#!/bin/bash
while python sleeptill.py *.tex; do ./tex.sh; done
import os
import sys
import time
def get_times(file_list):
times = []
for filename in file_list:
times.append(os.stat(filename).st_mtime)
return times
def main():
print 'watching ', sys.argv[1:]
prev_times = get_times(sys.argv[1:])
while True:
time.sleep(1)
new_times = get_times(sys.argv[1:])
if new_times != prev_times:
break
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment