Skip to content

Instantly share code, notes, and snippets.

View cchamberlain's full-sized avatar

Cole Chamberlain cchamberlain

View GitHub Profile
@cchamberlain
cchamberlain / rdiff.ps1
Last active May 5, 2024 01:42
Recursively diffs 2 directories (files and contents) using MD5 hashes - Includes validation for paths and optional summary export. Requires PowerShell 3.0 or later.
#########################################################################
### USAGE: rdiff path/to/left,path/to/right [-s path/to/summary/dir] ###
### ADD LOCATION OF THIS SCRIPT TO PATH ###
#########################################################################
[CmdletBinding()]
param (
[parameter(HelpMessage="Stores the execution working directory.")]
[string]$ExecutionDirectory=$PWD,
[parameter(Position=0,HelpMessage="Compare two directories recursively for differences.")]
@cchamberlain
cchamberlain / AlgorithmExtensions.cs
Last active September 24, 2022 14:27
Extension methods for common algorithms.
/// <summary>
/// Algorithmic extension methods
/// </summary>
public static class AlgorithmExtensions {
private static readonly ThreadLocal<Random> Rng = new ThreadLocal<Random>(() => new Random());
private static readonly ThreadLocal<CryptoRandom> RngCrypto = new ThreadLocal<CryptoRandom>(() => new CryptoRandom());
/// <summary>
/// Shuffle a sequence using Fisher-Yates shuffle algorithm.
@cchamberlain
cchamberlain / git-fix.ps1
Last active July 5, 2022 16:31
Applies registry change to disable luafv and make git much faster on windows (requires restart)
<#
This script will disable luafv on your system and likely make Windows versions of git faster after restarting.
### DISCLAIMER: THIS WILL MODIFY HOW SECURITY WORKS ON YOUR SYSTEM AND I WOULD ONLY USE ON A DEV MACHINE ###
### USE AT YOUR OWN RISK ###
#>
Push-Location
Set-Location HKLM:\SYSTEM\CurrentControlSet\Services\luafv
Set-ItemProperty . Start 4
@cchamberlain
cchamberlain / ExampleBase.cs
Last active March 26, 2021 14:59
ILog.cs / Log.cs - NLog service wrapper
using System;
using System.Threading;
using NLog;
using App.Diagnostics;
namespace App {
public abstract class ExampleBase {
private static readonly Lazy<ILogger> GenericLogger = new Lazy<ILogger>(LogManager.GetCurrentClassLogger, LazyThreadSafetyMode.PublicationOnly);
protected ILog Log { get; private set; }
@cchamberlain
cchamberlain / DapperService.cs
Last active March 20, 2019 06:28
DapperService.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection;
using System.Runtime.Caching;
using System.Threading.Tasks;
{
"compilerOptions": {
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"target": "ES5",
"jsx": "react",
"noImplicitReturns": true,
"noStrictGenericChecks": true,
"sourceMap": true,
{
"extends": ["tslint-react"],
"jsRules": {
"class-name": true,
"comment-format": [
true,
"check-space"
],
"indent": [
true,
@cchamberlain
cchamberlain / settings.json
Created July 16, 2018 20:05
VSCode Settings
{
"editor.fontSize": 14,
"editor.fontFamily": "'Operator Mono', Consolas, monospace",
"editor.cursorBlinking": "blink",
"terminal.integrated.drawBoldTextInBrightColors": false,
// Enable some vim ctrl key commands that override otherwise common operations, like ctrl+c
"vim.useCtrlKeys": false,
"workbench.colorTheme": "Material Theme",
"window.zoomLevel": -1,
@cchamberlain
cchamberlain / .zshenv
Last active October 27, 2017 22:45
USR_ZSHENV
#!/usr/bin/env zsh
#
# THIS FILE IS FOR USER SPECIFIC SETTINGS ONLY
export ZDOTDIR="${ZDOTDIR:-"$HOME/.zsh"}"
export GIT_USERNAME="cchamberlain"
export GIT_NPM_ID="npm/npm"
export GIT_ZDOTDIR_ID="cchamberlain/zdotdir"
export GIT_ZPREZTO_ID="cchamberlain/prezto"
@cchamberlain
cchamberlain / pod.ps1
Last active July 2, 2017 11:44
PowerShell script for server deployments. Requires PowerShell 3.0 or later.
[CmdletBinding()]
param (
[parameter(HelpMessage="Enable tracing messages.")]
[alias("t")]
[switch]$POD_TRACE,
[parameter(HelpMessage="Enable debugging messages.")]
[alias("d")]
[switch]$POD_DEBUG=$POD_TRACE,