How to set or modify a task to be due end of day tomorrow with taskwarrior? - taskwarrior

I would like to set the deadline for a task to be end of day tomorrow. The following was my first attempt:
task add 'Ask question about tw on StackOverflow' due:tomorrow eod
That fails, resulting in eod being appended to the description:
21 4s 14h Ask question about tw on StackOverflow eod 8.52
Is there a concise way of doing that? From the docs it seems hardcoding the date/time may be the only way: https://taskwarrior.org/docs/dates.html

You can do it like this:
task add 'Ask question about tw on StackOverflow' due:tomorrow+24h
Note that you can also abbreviate tomorrow with tom which would make the command
task add 'Ask question about tw on StackOverflow' due:tom+24h
See calc command documentation for more examples of the uses of arithmetic operators in Taskwarrior.

Related

Fine Tuning GPT-3 for Consistent Output Format

I am trying to use Open AI API to create quiz questions with three incorrect answers and one correct answer. The prompt I use is
`Write a quiz on ${quiz_topic} with 5 questions. Each question has 3 incorrect answers and 1 correct answer. The correct answer is always the last answer. Write each answer on a separate line`
I would like to parse ChatGPT's answer but the format is inconsistent. For instance, is quiz_topic is "literature", I get the following response:
Q1. Who wrote the novel "The Catcher in the Rye"?
A. J.D. Salinger
B. Ernest Hemingway
C. F. Scott Fitzgerald
D. Mark Twain
This is the correct format. But if I use "U.S History", I get the following output:
Q1: Who was the first president of the United States?
A1: George Washington Jr., Thomas Jefferson, John Adams, George Washington
This is a different format. So my goal is to fine-tune it using the article here
I have created 200 line of a training set. Here is a sample:
{"prompt":"Write a quiz on general knowledge with 5 questions. Each question has 3 incorrect answers and 1 correct answer. The correct answer is always the last answer.Write each answer on a separate line \n\n---\n\n","completion":" Q. What is the Italian word for "tomato"?\nA. Aglio\nA. Cipolla\nA. Peperoncino\nA. Pomodoro\n\nQ. Which restaurant's mascot is a clown?\nA. Whataburger\nA. Burger King\nA. Sonic\nA. McDonald's\n\nQ. Which of these colours is NOT featured in the logo for Google?\nA. Yellow\nA. Blue\nA. Green\nA. Pink\n\nQ. In 2013 how much money was lost by Nigerian scams?\nA. $95 Million\nA. $956 Million\nA. $2.7 Billion\nA. $12.7 Billion\n\nQ. What is the name of Poland in Polish?\nA. Pupcia\nA. Polszka\nA. Póland\nA. Polska\n\n \n\n###\n\n"}
{"prompt":"Write a quiz on books with 5 questions. Each question has 3 incorrect answers and 1 correct answer. The correct answer is always the last answer.Write each answer on a separate line \n\n---\n\n","completion":" Q. What is the name of Eragon's dragon in "Eragon"?\nA. Glaedr\nA. Thorn\nA. Arya\nA. Saphira\n\nQ. In the "The Hobbit", who kills Smaug?\nA. Bilbo Baggins\nA. Gandalf the Grey\nA. Frodo\nA. Bard\n\nQ. What is Hermione Granger's middle name?\nA. Jane\nA. Emma\nA. Jo\nA. Jean\n\nQ. According to The Hitchhiker's Guide to the Galaxy book, the answer to life, the universe and everything else is...\nA. Loving everyone around you\nA. Chocolate\nA. Death\nA. 42\n\nQ. What is the name of the three headed dog in Harry Potter and the Sorcerer's Stone?\nA. Spike\nA. Poofy\nA. Spot\nA. Fluffy\n\n \n\n###\n\n"}
When I run the validation tool with the command
openai tools fine_tunes.prepare_data -f training.jsonl
I get the following message
- All prompts start with prefix `Write a quiz on `. Fine-tuning doesn't require the instruction specifying the task, or a few-shot example scenario. Most of the time you should only add the input data into the prompt, and the desired output into the completion
I don't understand why I must remove "Write a quiz on". So I have misunderstood how to fine-tune a model for consistent formatting.
Can anybody shed a light on how to make sure I get the same formatting with the same prompt

Taskwarrior - How not to display the age of a task

I am using taskwarrior together with conky and to make the format look nicer, I want to modify, what information is actually given by taskwarrior.
In particular, I do not want it to display the "Age" column of a task.
Right now it looks like this:
ID Age Due Description Urg
1 33min 1d Do Stuff 8.33
but I want it to look more like this:
ID Due Description Urg
1 1d Do Stuff 8.33
Is there an easy way of doing this?
Thanks in advance!
Add the following lines to the file ~/.taskrc:
report.report1.description=Report without age attribute
report.report1.columns=id,due,description,urgency
Then you can run task report1 to view the report.
I prefer to edit the default reports. With this command:
task show report
You will get the configuration of all the reports. The default report of task command is report.next, so you can put this in your .taskrc without entry.age:
report.next.columns=id,start.age,depends,priority,project,tags,recur,scheduled.countdown,due.relative,until.remaining,description,urgency
report.next.labels=ID,Active,Deps,P,Project,Tag,Recur,S,Due,Until,Description,Urg
Now the task command will show the next report without the Age.

How Do You Represent Tomorrow Morning?

Using momentjs, I am trying to represent tomorrow at 7:00 AM (in server time).
Something like this:
var tomorrowEarlyAm = moment().add(1, 'day').add(7, 'hour');
However, of course, adding 1 day means we are at this same time tomorrow, so adding 7 hours is basically adding 31 hours.
The difficulty is that I don't know a simple way of clipping this to midnight:
var tomorrowMidnight = moment().add(1, 'day').??
basically you can go to today's 12 AM by using .startOf('day') and then add one day .add(1, 'day') and then 7 hours .add(7, 'hour')
all to gather as bellow,
moment().startOf('day').add(1, 'day').add(7, 'hour');
as suggested by #Mat J
or you may add 31 hours directly
moment().startOf('day').add(31, 'hour');

taskwarrior - Is it possible to report on the time spent on tasks?

I'm trying to use taskwarrior to track time for billing purposes.
To do that I'm trying to generate a report showing the hours spend on each task. The standard completed report gives the Created and Completed dates but not times, so I cant see how many hours were spent on the task.
$ task completed project:test
ID UUID Created Completed Age Project Description
- fed3daca 2019-09-29 2019-09-29 10min test test1
- 31a8f13e 2019-09-29 2019-09-29 1min test test2
2 tasks
Is this something taskwarrior can do?
Thanks
I don't think taskwarrior can create those reports by itself, but you could use timewarrior to do that.
After you set up timewarrior, the time spent on each task will be tracked.
Example:
➜ ~ task add reply on stack overflow
Created task 341.
➜ ~ task start 341
Starting task 81b73133 'reply on stack overflow'.
Started 1 task.
Tracking "reply on stack overflow"
Started 2020-04-10T12:07:58
Current 59
Total 0:00:01
➜ ~ task 341 done
Completed task 81b73133 'reply on stack overflow'.
Completed 1 task.
Recorded "reply on stack overflow"
Started 2020-04-10T12:07:58
Ended 09:12
Total 0:01:14
By default you will see how much time you spent on the task. In case you start and stop the task multiple times or want to see the time you spent on a project or on tasks with a certain tag, you can query timewarrior directly:
➜ ~ timew summary 'reply on stack overflow'
Wk Date Day Tags Start End Time Total
W15 2020-04-10 Fri reply on stack overflow 12:07:58 12:09:12 0:01:14 0:01:14
0:01:14
This shows you the time you spent today on that task. You can also specify a time interval in case you want to see the total time spent on the task/project/tag.
Example:
➜ ~ timew summary 2020-01-01 - tomorrow 'reply on stack overflow'
Wk Date Day Tags Start End Time Total
W15 2020-04-10 Fri reply on stack overflow 12:07:58 12:09:12 0:01:14 0:01:14
0:01:14
To see how much time you spent on project test you can just run:
timew summary 2018-01-01 - tomorrow test
This will also include the tasks named 'test' and tasks with the tag test.
As mentioned by Tom Dörr use timewarrior to summarize by tags.
This is the way I do:
Collect the tags by date range, modify the date range for your needs:
timew tags :week
Remove the headings from the output:
timew tags :week | tail -n+4
Use awk to separate the fiels by dash and print first field:
timew tags :week | tail -n+4 | awk 'BEGIN {FS="-"}; {print $1}'
This results in a list of tags for the selected date range, each in one line. Now you can use a script (for example summarize.sh) to loop through these tags to summarize:
#!/bin/bash
while read TAG; do
[ "${TAG}" = "" ] && continue
timew summary :week "${TAG}"
done < <(timew tags :week | tail -n+4 | awk 'BEGIN {FS="-"}; {print $1}')
This way you can handle tags containing whitespace also.
At least, run a loop in shell/bash to update permanently, for example every second:
while :; do clear; date; ./summarize.sh; sleep 1; done

In Bash, How would you only read lines in a log past a certain timestamp?

So right now I'm trying to do the following:
grep "string" logfile.txt
which is going fine, but there's a lot of "string" in logfile.txt; I really only want to see the last hour's worth. In pseudo-code I want to do...
grep "string" logfile.txt OnlyShowThoseInTheLastHour
Is there any way to easily accomplish this in bash? In the logfile the lines look like this:
13:27:50 string morestuff morestuff morestuff
edit: sorry I forgot to mention it, but seeing logs from similar hours on past days is not an issue as these logs are refreshed/archived daily.
This should do it:
awk 'BEGIN { tm = strftime("%H:%M:%S", systime()-3600) } /string/ && $1 >= tm' logfile.txt
Replace string by the pattern you're interested in.
It works by first building a string holding time information from 1 hour ago in HH:MM:SS format, and then selecting those lines that only match string and have the first field (timestamp) lexicographically greater than or equal to the timestamp string just built.
Note that it has its limitations, for example, if you do this at 00:30, log entries from 23:30 through 23:59 will not match. In general, running this command anytime between 00:00 and 00:59 will possibly omit log entries from 23:00 through 23:59. However, this shouldn't be an issue for you, since you mentioned (in the comments) that logs archive and start fresh every midnight.
Also, leap seconds are not dealt with, but this is probably not a problem unless you need 100% precise results. And again - since logs start afresh at midnight, in your specific case this is not a problem at all.

Resources