-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsteak.py
executable file
·45 lines (32 loc) · 869 Bytes
/
steak.py
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
42
43
44
45
#!/usr/bin/env python
"""
Utility script to help frying steaks and suchlike =)
"""
from __future__ import division, print_function, unicode_literals
import argparse
DEFAULT_INTERVAL = 30
def beep():
"""
Play audio signal with SoX
"""
pass
def to_ternary_list(num):
"""
Convert a number to ternary numeral list for audio "encoding"
"""
if num < 3:
return [num]
return to_ternary_list(num // 3) + [num % 3]
def parse_args():
"""
Parse command line arguments
"""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('-i', '--interval', default=DEFAULT_INTERVAL,
help="interval between beeps", type=int)
return parser.parse_args()
def main():
args = parse_args()
print(to_ternary_list(args.interval))
if __name__ == '__main__':
main()