This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Uptime calculation for SLAs. | |
Gary Kenneally | |
*/ | |
const double daysInYear = 365.2425; | |
const double monthsInYear = 12; | |
const double daysInMonth = daysInYear / monthsInYear; | |
const double second = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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>() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Greatest Common Denominator using Euclidian Algorithm | |
int gcd(int a, int b) | |
{ | |
return b==0 ? a : gcd(b, a % b); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | |
NewerOlder