commit 594103a34607403825631dd217e913e6ea49e044
parent 2c4127f74b4bacd8e3ae5ae4844975fd568147d1
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Tue, 18 Jun 2019 16:07:36 +0200
track: added
Former-commit-id: adf22a0fbcae1e75eff8cee3d8357cb77cf556bd
Diffstat:
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md
@@ -40,6 +40,7 @@ If you read a script and see some improvements that could be made, let me know.
* `tag`: a command-line `mp3tagger.jar`. Usage: `tag filename.mp3`
* `topdf`: converts a file to a PDF using cupsfilter. Works well on docx files. Usage: `topdf file [file2 file3 file4...]`
* `tput-colors`: a simple script to print out a `tput` color table
+* `track`: time tracking script. Run `track` to start, `track stop` to stop and show time elapsed in seconds.
* `updatemaster`: the ultimate all-in-one update script (Brew, Cask, MAS, pip, etc.). Run with `-h` to see options.
* `usbmux`, `tcprelay`: port forwarding. If you want to SSH to a jailbroken iPhone over USB, you can run `tcprelay 22:2222` to forward local port 2222 to the iPhone's SSH port (22), and then `ssh -p 2222 root@localhost`.
* `vimwiki_md`: convert vimwiki files to markdown, using the vimwiki_md_ex expressions file for sed. Still a work-in-progress and probably very buggy.
diff --git a/scripts/track b/scripts/track
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+if ! cd "$(dirname $0)" &> /dev/null; then
+ echo "Could not enter $(dirname $0)."
+ exit 1
+fi
+if [ $# -eq 0 ]; then
+ date +%s > .timetrackfile
+ echo "Tracking time."
+elif [ "$1" = "stop" ]; then
+ echo "Complete: $(expr $(date +%s) - $(cat .timetrackfile))"
+ rm .timetrackfile
+fi