Skip to content

Instantly share code, notes, and snippets.


Nick Craver NickCraver

View GitHub Profile
NickCraver / ExampleUsage.cs
Last active Nov 27, 2021
Code to mark a SQL string before it's passed to Dapper.
View ExampleUsage.cs
public static List<T> Query<T>(this DataContext db, string sql, object param = null, int? commandTimeout = null, IDbTransaction transaction = null, [CallerFilePath]string fromFile = null, [CallerLineNumber]int onLine = 0, string comment = null)
using (db.Connection.EnsureOpen())
return db.Connection.Query<T>(MarkSqlString(sql, fromFile, onLine, comment), param, transaction ?? db.Transaction, true, commandTimeout).AsDapperList();
catch (SqlException ex) when (ex.Is(SqlErrorCode.DatabaseReadOnly_3906))
View Microsoft.PowerShell_profile.ps1
# This goes in your Microsoft.PowerShell_profile.ps1 (can find the path via $PROFILE in your prompt)
Import-Module -Name posh-git,oh-my-posh,Terminal-Icons
Set-PoshPrompt -Theme craver
NickCraver / Build.xml
Last active Nov 24, 2021
Stack Overflow Build Reference Docs
View Build.xml
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="PrepareStaticContent" xmlns="">
<!-- Passed in Parameters -->
NickCraver / BotLovin.cs
Last active Nov 22, 2021
Some bot/crawler fun on Stack Overflow. 10 hours of fun, to be precise.
View BotLovin.cs
private static readonly string[] tenHoursOfFun =
NickCraver / Windows10-Setup.ps1
Last active Nov 17, 2021
(In Progress) PowerShell Script I use to customize my machines in the same way for privacy, search, UI, etc.
View Windows10-Setup.ps1
# Privacy Settings
# Privacy: Let apps use my advertising ID: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0
# To Restore:
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 1
# Privacy: SmartScreen Filter for Store Apps: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 0
NickCraver /
Created Sep 2, 2021
Legion 7 dotnet/aspnetcore build timings

Machine info

Lenovo Legion 7 AMD 5900HX (8C/16T) 32 GB RAM 2TB NVMe

Repo info

git rev-parse HEAD 916e008178a1dc2c9f33475437e2ebf257cd7cd6

NickCraver / Craver-Paradox.ps1
Last active Jun 15, 2021
My PowerShell PoshGit theme (used with Cmder)
View Craver-Paradox.ps1
#requires -Version 2 -Modules posh-git
# This is a tweaked version of
function Write-Theme {
NickCraver / DmpAnalysis.linq
Last active Jun 3, 2021
DMP Analysis in LinqPad
View DmpAnalysis.linq
<Query Kind="Program">
<NuGetReference Prerelease="true">Microsoft.Diagnostics.Runtime</NuGetReference>
NickCraver / .editorconfig
Created Sep 26, 2017
Stack Overflow's .editorconfig
View .editorconfig
root = true
# Don't use tabs for indentation.
indent_style = space
charset = utf-8
end_of_line = lf
NickCraver /
Created Apr 10, 2016
A simple LINQPad script I wrote for load testing SQL Server.

This is a simple LINQPad script I wrote one day to load test some large SQL servers. Maybe it's useful to someone. The basic premise is defining your queries once, including which ID patterns to fetch (at the bottom), and load test a mixture. The script defines everything needed in one place, then fires up the command-line linqpad runner to run many queries at once.

Params up top:

const string LinqPadPath = @"C:\Linqpad\lprun.exe";
const bool runSequential = false;
const int defaultThreads = 1;
const int defaultIterations = 2000;