1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/usr/bin/env python3
import sys, time, subprocess
try:
log_file = sys.argv[1]
how_often = float(sys.argv[2])
time_to_do_it = float(sys.argv[3])
except:
print("rtfc :P")
sys.exit(-1)
try:
f = open(log_file, "w")
except:
print("fake file.")
sys.exit(-1)
print("[i] file: %s\n\
[i] how often: %f\n\
[i] how long: %f" % (log_file, how_often, time_to_do_it))
start = time.time()
now = time.time
print("[i] we out here, yo", flush=True)
while (start + time_to_do_it) > now():
# print("we out here, yo", flush=True)
lat, lon, alt, sig = [float(x) for x in subprocess.getoutput("src/dirty_hack.sh").split(",")]
sig /= 100
print("[i] %f: %f, %f, %f, %f" % (time.time_ns() / (10**9), lat, lon, alt, sig))
f.write("%f: %f, %f, %f, %f\n" % (time.time_ns() / (10**9), lat, lon, alt, sig))
f.flush()
time.sleep(how_often)
f.close()
|