Skip to content

Instantly share code, notes, and snippets.

View programmerextraordinaire's full-sized avatar

Thane Plummer programmerextraordinaire

  • AppVizo
  • United States
View GitHub Profile
@programmerextraordinaire
programmerextraordinaire / TrimArray.cs
Created August 9, 2018 17:56
Array trim and delete helper functions in C#.
// TrimArray.cs
// From: https://stackoverflow.com/questions/26303030/how-can-i-delete-rows-and-columns-from-2d-array-in-c
// See: https://stackoverflow.com/questions/1183083/is-it-possible-to-extend-arrays-in-c
void Main()
{
int[,] array = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
array.Dump();
var trim = TrimArray(1, 1, array);
var trimRow = ArrayRemoveRow(2, array);
@programmerextraordinaire
programmerextraordinaire / EstimatePi.cs
Last active August 9, 2018 17:52
From a StackOverflow question about estimating Pi. Answered in LinqPad.
// From: http://stackoverflow.com/questions/406760/whats-your-most-controversial-programming-opinion
// Given that Pi can be estimated using the function 4 * (1 - 1/3 + 1/5 - 1/7 + ...)
// write a function that calculates Pi to an accuracy of 5 decimal places.
var oddFractions = new List<double>();
var pi = 4.0;
// Fill the oddFractions list until we have 5 decimal places of accuracy.
for (int i = 1, j = 1; j < 1000000; i++, j+=2)
{
@programmerextraordinaire
programmerextraordinaire / CharacterHistogram.cs
Created August 9, 2018 17:36
Character histogram of a string into 64-bit unsigned long.
///
/// CharacterHistogram.cs
/// by tkp
///
void Main()
{
var s1 = "NOE TIMMY HEATH";
var s2 = "NOEL TIMOTHY HEATH";
@programmerextraordinaire
programmerextraordinaire / BoxStarter IQAS3
Last active November 25, 2015 17:29
BoxStarter install script for IQAutoScan3.
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
cinst powershell -pre
cinst notepadplusplus
cinst git-credential-winstore
cinst console-devel
cinst sublimetext2
cinst poshgit
cinst 7zip