Skip to content

Instantly share code, notes, and snippets.

@SecretDeveloper
Created November 12, 2018 13:38
Show Gist options
  • Save SecretDeveloper/d787dcd029280007f026c42e1826be79 to your computer and use it in GitHub Desktop.
Save SecretDeveloper/d787dcd029280007f026c42e1826be79 to your computer and use it in GitHub Desktop.
Starts a pomodoro task, default is 25 minutes.
param (
[string]$minutes = 25, # typically pomodoro tasks use 25 minutes or 'work' followed by a short break
[string]$taskname = "Task"
)
$start=$(get-date);
$diff=$(get-date)-$start
$total=new-object TimeSpan -argumentList 0,$minutes,0
$t=get-date
Write-Host("'$taskname' started at $t")
while ($diff -lt $total) {
write-progress -activity $diff -PercentComplete (($diff.TotalSeconds/$total.TotalSeconds)*100) -Status "Work on '$taskname' for $minutes minutes."
sleep 1
$diff=$(get-date)-$start
}
$t=get-date
Write-Host("'$taskname' completed at $t")
[console]::beep(2000,900)
sleep 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment