Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Shipping

Nick Craver NickCraver

:shipit:
Shipping
View GitHub Profile
@NickCraver
NickCraver / master-id.diff
Created Aug 21, 2015
MASTER MODE enabled (user request from '<client>') redis patch
View master-id.diff
diff --git a/src/replication.c b/src/replication.c
index 8102fc2..d9545b8 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -1250,8 +1250,10 @@ void slaveofCommand(redisClient *c) {
if (!strcasecmp(c->argv[1]->ptr,"no") &&
!strcasecmp(c->argv[2]->ptr,"one")) {
if (server.masterhost) {
+ sds client = getClientInfoString(c);
replicationUnsetMaster();
@NickCraver
NickCraver / SE Cluster 2 D-Drive (Tier 1).log
Last active Aug 29, 2015
Stack Overflow SQLIO Numbers
View SE Cluster 2 D-Drive (Tier 1).log
# Dual Intel P3700 2TB PCIe NVMe SSD Drives in a RAID 0
C:\Program Files (x86)\SQLIO>echo BUFFERED
BUFFERED
C:\Program Files (x86)\SQLIO>sqlio -kW -t8 -s120 -o8 -frandom -b8 -BH -LS -Fparam-D.txt
sqlio v1.5.SG
using system counter for latency timings, 3125001 counts per second
parameter file used: param-D.txt
file D:\testfile.dat with 2 threads (0-1) using mask 0x0 (0)
@NickCraver
NickCraver / SODailyRep.user.js
Created Oct 27, 2010
Adds a "total rep today" number in the top bar for all StackExchange sites - Only works in Chrome, only makes a request every 30 min or when your total rep changes.
View SODailyRep.user.js
// ==UserScript==
// @name SO Daily Reputation
// @namespace soRepDaily
// @description Shows reputation for the current day.
// @include http://stackoverflow.com/*
// @include http://serverfault.com/*
// @include http://superuser.com/*
// @include http://meta.stackoverflow.com/*
// @include http://*.stackexchange.com/*
// ==/UserScript==
@NickCraver
NickCraver / enter-comments.user.js
Created Dec 9, 2010
User Script - Disable Enter key on comments on StackExchange.
View enter-comments.user.js
// ==UserScript==
// @name Disable Enter key on comments on Stack Exchange.
// @namespace http://networkpx.googlecode.com
// @description Disable Enter key on comments on Stack Exchange.
// @include http://*.stackexchange.com/*
// @include http://stackoverflow.com/*
// @include http://meta.stackoverflow.com/*
// @include http://serverfault.com/*
// @include http://meta.serverfault.com/*
// @include http://superuser.com/*
@NickCraver
NickCraver / se-disable-search-animation.user.js
Created Aug 9, 2011
Stack Exchange search box animation disabler
View se-disable-search-animation.user.js
// ==UserScript==
// @name Stack Exchange search box animation disabler 1.0
// @namespace stackoverflow
// @description Removes Stack Exchange search box animation shenanigans
// @include http://stackoverflow.com/*
// @include http://*.stackoverflow.com/*
// @include http://*.stackexchange.com/*
// @include http://serverfault.com/*
// @include http://superuser.com/*
// @include http://stackapps.com/*
View SQL-Login-Replication.sql
SET NOCOUNT ON;
DECLARE @name sysname,
@PWD_varbinary varbinary (256),
@PWD_string varchar (514),
@SID_varbinary varbinary (85),
@SID_string varchar (514),
@sqlString varchar (1024),
@is_policy_checked varchar (3),
@is_expiration_checked varchar (3),
@defaultdb sysname;
@NickCraver
NickCraver / sp_Refresh_Database.sql
Created Oct 23, 2015
Stack Exchange Data Explorer - database import stored procedure.
View sp_Refresh_Database.sql
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Refresh_Database] @DBName nvarchar(100)
AS
BEGIN
SET NOCOUNT ON;
@NickCraver
NickCraver / dnx.log
Created Oct 25, 2015
DNX "Failed to start CLR host" log
View dnx.log
C:\DNXTest\Client\runtimes\dnx-coreclr-win-x86.1.0.0-beta8\bin>dnx
The default servicing root does not exist.
Loaded module: dnx.win32.coreclr.dll
Found export: CallApplicationMain
Failed to start CLR host
View Top By Query Hash.sql
DECLARE @MaxResultCount int = 500;
SELECT AvgCPU, AvgDuration, AvgReads, AvgCPUPerMinute,
TotalCPU, TotalDuration, TotalReads,
PercentCPU, PercentDuration, PercentReads, PercentExecutions,
ExecutionCount,
ExecutionsPerMinute,
PlanCreationTime, LastExecutionTime,
SUBSTRING(st.text,
(StatementStartOffset / 2) + 1,
@NickCraver
NickCraver / results.txt
Created Nov 3, 2015
string.Format() vs string.Concat() quick perf tests for Abstractions
View results.txt
string.Concat(): 3011 ms
string.Format(): 18337 ms
string.Concat(): 2885 ms
string.Format(): 18312 ms