Skip to content

Instantly share code, notes, and snippets.

View NickCraver's full-sized avatar
:shipit:
Shipping

Nick Craver NickCraver

:shipit:
Shipping
View GitHub Profile
@NickCraver
NickCraver / Program.cs
Created October 16, 2018 16:49
.NET Core Exceptions memory leak repro
using System;
using System.Threading.Tasks;
namespace ConsoleApp2189
{
public static class Program
{
public static void Main(string[] args)
{
while (true)
@NickCraver
NickCraver / notblue.css
Last active October 6, 2018 19:20
TweetDeck Dark Theme - Revert the Blue
html.dark .column, html.dark .stream-item {
background-color: #222426;
}
html.dark .detail-view-inline-text {
background: #fff;
color: #8899a6;
}
html.dark a, html.dark a:hover,
html.dark .other-replies-link, html.dark .other-replies-link:hover,
html.dark .btn-neutral-positive, html.dark .btn-neutral-positive:hover, html.dark .btn-neutral-positive:focus {
@NickCraver
NickCraver / OptInRelationalModelSource.cs
Last active August 22, 2018 19:31
OptInRelationalModelSource.cs - Making EF Core opt-in instead of opt-out for properties
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Reflection;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal;

Keybase proof

I hereby claim:

  • I am nickcraver on github.
  • I am nickcraver (https://keybase.io/nickcraver) on keybase.
  • I have a public key ASAVMojHFRx86OeapA0fAbGblg0VzqFn4agNkah58X9ixQo

To claim this, I am signing this object:

@NickCraver
NickCraver / TeamCity-Dev-Build-Log.txt
Created April 30, 2016 20:02
Stack Overflow Build Log Examples
Build 'Stack Exchange Network :: New York :: SENetwork - Dev' #21007
Started 'Wed Apr 27 23:54:04 UTC 2016' on 'NY-WEB05' by 'Git'
Finished 'Wed Apr 27 23:56:21 UTC 2016' with status 'NORMAL Success'
TeamCity URL https://build/viewLog.html?buildId=477326&buildTypeId=StackExchangeNetwork_NewYork_SENetworkDev
TeamCity server version is 9.1.5 (build 37377)
[23:54:03]i: TeamCity server version is 9.1.5 (build 37377)
[23:54:03]W: bt4 (2m:17s)
[23:54:03] : projectId:project55 projectExternalId:StackExchangeNetwork_NewYork buildTypeId:bt4 buildTypeExternalId:StackExchangeNetwork_NewYork_SENetworkDev
[23:54:03] : Collecting changes in 2 VCS roots (1s)
@NickCraver
NickCraver / Win10-DisableLockScreen.ps1
Created August 3, 2015 02:46
Disable the lock screen (the one before the password prompt) in Windows 10 for faster login and not dropping the first password character.
# Disable the Lock Screen (the one before password prompt - to prevent dropping the first character)
If (-Not (Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization)) {
New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows -Name Personalization | Out-Null
}
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization -Name NoLockScreen -Type DWord -Value 1 -Force
@NickCraver
NickCraver / Stylus.StackExchange.css
Created July 7, 2017 21:27
My Stylus theme for Stack Exchange MiniProfiler and Chat
@-moz-document domain("stackoverflow.com"), domain("stackexchange.com"), domain("serverfault.com"), domain("askubuntu.com"), domain("stackapps.com"), domain("superuser.com") {
.profiler-result tr[style*='display: block;'] {
display: table-row !important;
}
.profiler-result th[style*='display: block;'], .profiler-result td[style*='display: block;'] {
display: table-cell!important;
}
}
@-moz-document domain("chat.meta.stackexchange.com"), domain("chat.stackexchange.com"), domain("chat.stackoverflow.com") {
@NickCraver
NickCraver / Query.sql
Created June 1, 2017 21:50
SQL Divide By Zero Glitch with aggregates
SELECT [tag.iface], [tag.host], Sum([value]) [value], [timestamp]
FROM (SELECT [tag.iface], [tag.host], [tag.direction], [dateDiff], Max([value]) [value],
DateAdd(Second, DateDiff(Second, GETUTCDATE(), [timestamp]) / 15 * 15, GETUTCDATE()) [timestamp]
FROM (SELECT [tag.iface],
[tag.host],
[tag.direction],
[timestamp],
DateDiff(Second, [LastTime], [timestamp]) [dateDiff],
--(([value] - [LastValue]) / NullIf(DateDiff(Second, [LastTime], [timestamp]), 0)) [value]
(([value] - [LastValue]) / DateDiff(Second, [LastTime], [timestamp])) [value]
@NickCraver
NickCraver / VPN-DNS-Test.ps1
Created April 27, 2017 12:19
Windows 10 VPN/DNS problem repro
# Must be run as admin for registry changes
# This illustrates the problem with the Stack Exchange VPN, results locally:
# Total time for default behavior (seconds): 12.0566448
# Total time with registry tweaks (seconds): 1.0808937
# Broken/Slow (default Windows 10 behavior)
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows NT\DNSClient" -Name DisableSmartNameResolution -Value 0 -Type DWord
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters" -Name DisableParallelAandAAAA -Value 0 -Type DWord
ipconfig /flushdns | Out-null
Write-Host "Total time for default behavior (seconds): " -NoNewLine
@NickCraver
NickCraver / 01. TrafficLogs.sql
Last active April 20, 2017 18:09
Setup scripts for TrafficLogs.sql - table partitioning and archive movement fun.
-- For production
--CREATE DATABASE [TrafficLogs] CONTAINMENT = NONE ON
--PRIMARY ( NAME = N'TrafficLogs', FILENAME = N'E:\Data\TrafficLogs.mdf' , SIZE = 102400000KB , FILEGROWTH = 5120000KB),
--FILEGROUP [TrafficLogs_D] ( NAME = N'TrafficLogs_D', FILENAME = N'D:\Data\TrafficLogs_D.ndf' , SIZE = 102400000KB, FILEGROWTH = 51200000KB),
--FILEGROUP [TrafficLogs_E] ( NAME = N'TrafficLogs_E', FILENAME = N'E:\Data\TrafficLogs_E.ndf' , SIZE = 1024000000KB, FILEGROWTH = 51200000KB)
--LOG ON ( NAME = N'TrafficLogs_log', FILENAME = N'D:\Data\TrafficLogs.ldf' , SIZE = 51200000KB , FILEGROWTH = 10240000KB)
--GO
-- For local development
Declare @dataPath nvarchar(500) = Cast(ServerProperty('instancedefaultdatapath') as nvarchar(500)),