Skip to content

Instantly share code, notes, and snippets.

Verifying my Blockstack ID is secured with the address 1AMBXXdTPtWNm6szYn9gaMVupZjX1srM3K https://explorer.blockstack.org/address/1AMBXXdTPtWNm6szYn9gaMVupZjX1srM3K
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
namespace EfSelectIssue
{
class Program
{
static void Main(string[] args)
@lukemcgregor
lukemcgregor / windows10-unbloat.ps1
Last active May 17, 2021 01:17
Remove windows 10 bloatware.
# This script will remove all the nonsense from your blank windows 10 install.
# comment or remove any of these you actually care about.
$bloatPackages = @(
# I normally keep these
#"windowscalculator",
#"photos",
#"windowscamera",
#"windowsstore",
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
cinst sublimetext2
cinst Microsoft-Hyper-V-All -source windowsFeatures
cinst IIS-WebServerRole -source windowsfeatures
@lukemcgregor
lukemcgregor / gist:5914774
Created July 3, 2013 01:30
Tester for the performance of SELECT WHERE IN
using NLog;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace ConsoleApplication8
/// <summary>
/// Based on code from:
/// http://pedroreys.com/2012/02/17/extending-asp-net-web-api-content-negotiation/
/// </summary>
public class NotAcceptableConnegHandler : DelegatingHandler {
private readonly HttpConfiguration _configuration;
public NotAcceptableConnegHandler(HttpConfiguration configuration) {
if (configuration == null) {
@lukemcgregor
lukemcgregor / nhrollback
Created May 20, 2012 20:44
Do NHibernate Transactions rollback with parent transaction scope?
using System;
using System.Data.SqlServerCe;
using System.IO;
using System.Reflection;
using Moq;
using NHibernate;
using NHibernate.ByteCode.Castle;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
@lukemcgregor
lukemcgregor / EfFkExample.cs
Created May 16, 2012 08:37
Shows that EF by default uses _ in fk names
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Program
@lukemcgregor
lukemcgregor / Program.cs
Created April 25, 2012 11:44
Slow batch insert
This file has been truncated, but you can view the full file.
/* create a blank db named test-db then run this create table scripts:
USE [test-db]
GO
/****** Object: Table [dbo].[TestEntities] Script Date: 04/25/2012 23:37:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
@lukemcgregor
lukemcgregor / sqlSlower
Created April 6, 2012 05:49
SQL is slower straight after creating the DB, This occurs because of AutoGrow
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication8
{