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 / 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)
@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 / 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 / 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 / ConvertVisioToPNG.vbs
Last active October 7, 2019 13:03
ConvertVisioToPNG.vbs
Option Explicit
'################################################
'This script is to export Visio and PUML files to PNG files
'################################################
Sub main()
Dim ArgCount, argumentPath, workItems, skipped, scriptdir
ArgCount = WScript.Arguments.Count
@SecretDeveloper
SecretDeveloper / unsong.fs
Last active November 10, 2016 18:34
unsong.fs
// Create epub file from unsongbook.com and write to console.
open FSharp.Data
open System.Collections.Generic
type Chapter(title:string, body:string, url:string)=
member x.Title = title
member x.Body = body
member x.URL = url
let chapters = new List<Chapter>()
@SecretDeveloper
SecretDeveloper / GenerateRandomString.cs
Last active September 11, 2015 10:42
Generate Random String
public static string GenerateRandomString(int length = 32)
{
if (length <= 0)
throw new ArgumentException("provided length must be greater than 0");
using (RNGCryptoServiceProvider cryptoProvider = new RNGCryptoServiceProvider())
{
var bytes = new byte[length];
cryptoProvider.GetNonZeroBytes(bytes);
@SecretDeveloper
SecretDeveloper / Greatest Common Denominator using Euclidian Algorithm
Created June 19, 2015 13:14
Greatest Common Denominator using Euclidian Algorithm
// Greatest Common Denominator using Euclidian Algorithm
int gcd(int a, int b)
{
return b==0 ? a : gcd(b, a % b);
}
@SecretDeveloper
SecretDeveloper / Safely loading JS libraries (jQuery).js
Last active August 29, 2015 14:04
Safely loading JS libraries (jQuery)
function loadScript(address, callback) {
var script_tag = document.createElement('script');
script_tag.setAttribute("type", "text/javascript");
script_tag.setAttribute("src", address);
if (script_tag.readyState) {
script_tag.onreadystatechange = function () { // For old versions of IE
if (this.readyState == 'complete' || this.readyState == 'loaded') {
callback();
}
};
@SecretDeveloper
SecretDeveloper / RE Builder for list comparison.cs
Last active August 29, 2015 14:04
Regular Expression Builder for filtering 2 list of terms - LINQpad version.
void Main()
{
string A = @"A New Hope
The Empire Strikes Back
Return of the Jedi
The Phantom Menace
Attack of the Clones
Revenge of the Sith";