Skip to content

Instantly share code, notes, and snippets.

View cchamberlain's full-sized avatar

Cole Chamberlain cchamberlain

View GitHub Profile
@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 / ConEmu.xml
Created July 23, 2015 02:47
My ConEmu.xml
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2015-07-22 13:35:19" build="150716">
<value name="ColorTable00" type="dword" data="00362b00"/>
<value name="ColorTable01" type="dword" data="0000bfa8"/>
<value name="ColorTable02" type="dword" data="00009985"/>
<value name="ColorTable03" type="dword" data="0098a12a"/>
<value name="ColorTable04" type="dword" data="00164bcb"/>
<value name="ColorTable05" type="dword" data="00c4716c"/>
@cchamberlain
cchamberlain / conemu-fatal-error
Created July 22, 2015 18:15
ConEmu Error: nNewWidth>0 && nNewHeight>0
## ERROR READS ##
Assertion in C:\Users\ColeChamberlain\local\conemu\ConEmu64.exe
[150716]
nNewWidth>0 && nNewHeight>0
at
RealBuffer.cpp:1796
## PASTE FROM ERROR POPUP ##
Assertion in C:\Users\ColeChamberlain\local\conemu\ConEmu64.exe [150716]
Exception 0x80000003 triggered in CRealConsole::MonitorThreadWorker
@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 / 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;
@cchamberlain
cchamberlain / .zshenv
Last active August 29, 2015 14:25
dot-zshenv
#!/usr/bin/env zsh
#
# Defines Environment Variables
# RESET ZSHENV FILE VIA ENVIRONMENT VARIABLE
export USR_ZSHENV_PATH="$HOME/.zshenv"
if [[ $USR_ZSHENV_RESET -eq 1 ]]; then
unset USR_ZSHENV_RESET
if [[ -z "$GIST_USR_ZSHENV_ID" ]]; then
export GIST_USR_ZSHENV_ID="ad8ae7ce3ef2a965295d"
@cchamberlain
cchamberlain / .vimrc
Last active March 30, 2016 17:42
dot-vimrc
execute pathogen#infect()
""" SYNTAX """
syntax on
syntax enable " enable syntax processing
""" SETTINGS """
set tabstop=2 " number of visual spaces per tab when opened
set expandtab " use spaces instead of tabs
@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 / install-npm-next.sh
Created July 6, 2015 06:02
install-npm-next.sh
#!/bin/sh
# A word about this shell script:
#
# It must work everywhere, including on systems that lack
# a /bin/bash, map 'sh' to ksh, ksh97, bash, ash, or zsh,
# and potentially have either a posix shell or bourne
# shell living at /bin/sh.
#
# See this helpful document on writing portable shell scripts:
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh