Add a load of handy ~/bin scripts

This commit is contained in:
2020-02-23 15:07:02 +01:00
parent 99fbfc42fe
commit 8032cee29c
13 changed files with 323 additions and 0 deletions

20
bin/kw Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env python3
import datetime
import sys
formats = (
'%Y-%m-%d',
'%d.%m.%Y')
for format in formats:
try:
day = datetime.datetime.strptime(sys.argv[1], format).date()
except ValueError:
continue
print(day.isocalendar()[1])
sys.exit(0)
print("no format matched:")
print("\n".join(" {}".format(f) for f in formats))
sys.exit(1)