Skip to content

Instantly share code, notes, and snippets.

View SecretDeveloper's full-sized avatar
🎯
Focusing

Gary Kenneally SecretDeveloper

🎯
Focusing
View GitHub Profile
@SecretDeveloper
SecretDeveloper / TimedDisposed.cs
Created November 8, 2017 13:54
TimedDisposed
public class TimedDisposed:IDisposable
{
Action<TimeSpan> _action;
Action<TimeSpan, string> _markAction;
DateTime _start;
List<KeyValuePair<DateTime, string>> _marks = new List<KeyValuePair<DateTime, string>>();
public bool ActionEnabled { get; set; }
public bool MarkActionEnabled { get; set; }
@SecretDeveloper
SecretDeveloper / uptime.cs
Created February 20, 2018 12:06
Uptime calculation for SLAs.
/*
Uptime calculation for SLAs.
Gary Kenneally
*/
const double daysInYear = 365.2425;
const double monthsInYear = 12;
const double daysInMonth = daysInYear / monthsInYear;
const double second = 1;
@SecretDeveloper
SecretDeveloper / start-pomodoro.ps1
Created November 12, 2018 13:38
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
@SecretDeveloper
SecretDeveloper / FrequencyGuesser.cs
Created October 20, 2022 13:15
Console game where you guess the frequency of the beep.
Console.WriteLine("Guess the frequency");
var random = new Random();
var playing = true;
var MIN = 37;
var MAX = 5000;
var threshold = MAX / 20;
var test = 37;
while (test <= MAX)