View ShortCodes.cs
using System;
namespace ShortCodes
public static class ShortCodes
// You may change the "shortcode_Keyspace" variable to contain as many or as few characters as you
// please. The more characters that are included in the "shortcode_Keyspace" constant, the shorter
// the codes you can produce for a given long.
private static string shortcodeKeyspace = "abcdefghijklmnopqrstuvwxyz0123456789";
View NumericHelpers.cs
public static class NumericHelpers
// Float point maths is whack. We can't check for absolute equality as floating point numbers are imprecise
// and are subject to rounding issues (See:
// Therefore, we can't check for absolute equality, but instead we have to need to check for values being
// "nearly" equal, which allows a small margin of error (i.e. something known as the "Epsilon" value for
// the given data type for this CPU that this code is running on).
public static bool NearlyEqual(double a, double b, double epsilon)
var absA = Math.Abs(a);
View GetWindowsProductKey.vbs
Option Explicit
Dim objshell,path,DigitalID, Result
Set objshell = CreateObject("WScript.Shell")
'Set registry key path
Path = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
'Registry key value
DigitalID = objshell.RegRead(Path & "DigitalProductId")
Dim ProductName,ProductID,ProductKey,ProductData
'Get ProductName, ProductID, ProductKey
View LargestDBs
SELECT DB_NAME(database_id) AS DatabaseName,
Name AS Logical_Name,
Physical_Name, (size*8)/1024 SizeMB
FROM sys.master_files
View .gitconfig
autocrlf = true
# Ensure to change the path and filename below !!!!!
excludesfile = D:\\Documents\\gitignore_global.txt
# Ensure to change the path and filenames below !!!!!
editor = 'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -nosession
preloadindex = true
View BetterRandom.cs
using System;
using System.Security.Cryptography;
namespace BetterRandomNumbers
// BetterRandom.cs
// This class implements a random number generator that is based off the Windows "Next Generation" cryptographically secure
// random number generator. It inherits from the base Random class, so can be used as a "drop-in" replacement for the
// built-in .NET System.Security.Random class, but providing a superior quality of random numbers.
public class BetterRandom : Random, IDisposable
View CleanUpTemporaryASPNETFiles.ps1
# Run this as Administrator
net stop w3svc
Get-ChildItem "C:\Windows\Microsoft.NET\Framework*\v*\Temporary ASP.NET Files" -Recurse | Remove-Item -Recurse -Force
net start w3svc
View RandomString.cs
using System;
using System.Text;
namespace RandomString
public class RandomString : IDisposable
// Can use the BetterRandom class here or just use the built-in System.Random class.
private BetterRandom random = new BetterRandom();
private const string alpha_selection = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
View TruncateAtWordStringExtension.cs
public static class StringExtentionMethods
public static string TruncateAtWord(this string input, int maxlength, bool addEllipsis)
if (input == null || input.Length <= maxlength) return input;
var ellipsisLengthDeduction = (addEllipsis ? 3 : 0);
var iLastSpace = input.LastIndexOf(" ", (maxlength - ellipsisLengthDeduction), StringComparison.Ordinal);
var iLength = 0;
if (iLastSpace < 0)
View NumberFunctions.cs
using System;
using System.Globalization;
namespace NumberFunctionUtilities
public static class NumberFunctions
public static bool IsNumeric(this object expression)
if (expression == null)