Skip to content

Instantly share code, notes, and snippets.

View jacobhackl's full-sized avatar

Jacob Hackl jacobhackl

  • minneapolis, mn
View GitHub Profile
@jacobhackl
jacobhackl / gist:678fb32a99029cdb7d4816ed5784f10f
Created March 28, 2017 18:51
Force https for iis rewrite and aws LB
<rule name="Force Https" stopProcessing="true">
<match url="health.htm" negate="true" />
<conditions>
<add input="{HTTP_X_FORWARDED_PROTO}" pattern="https" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
declare @hyperthreadingRatio bit
declare @logicalCPUs int
declare @HTEnabled int
declare @physicalCPU int
declare @SOCKET int
declare @logicalCPUPerNuma int
declare @NoOfNUMA int
select @logicalCPUs = cpu_count -- [Logical CPU Count]
@jacobhackl
jacobhackl / gist:248befe1feac5811b42b33a0be90ff67
Last active August 4, 2023 11:19
How to examine IO subsystem latencies from within SQL Server
--http://www.sqlskills.com/blogs/paul/how-to-examine-io-subsystem-latencies-from-within-sql-server/
SELECT
[ReadLatency] =
CASE WHEN [num_of_reads] = 0
THEN 0 ELSE ([io_stall_read_ms] / [num_of_reads]) END,
[WriteLatency] =
CASE WHEN [num_of_writes] = 0
THEN 0 ELSE ([io_stall_write_ms] / [num_of_writes]) END,
[Latency] =
CASE WHEN ([num_of_reads] = 0 AND [num_of_writes] = 0)
@jacobhackl
jacobhackl / Windows Server ownership and read rights.ps1
Created May 16, 2016 18:02
Windows Server ownership and read rights.ps1
TAKEOWN /F "<foldername>" /R /D N /A
Remove folder read-only attribute
ATTRIB -R /D /S "<Foldername>"
@jacobhackl
jacobhackl / export_directories_windows.bat
Last active May 3, 2016 15:28
Export the md command for all folders in a location
setlocal
set "location=d:\"
for /F "delims=" %%a in ('dir /s /ad /b "%location%"') do (
echo md %%a >> createDirectorys.bat
)
@jacobhackl
jacobhackl / program.cs
Created April 27, 2016 16:05
Batch insert into Google worksheet with c# and a service account with cert
using Google.Apis.Auth.OAuth2;
using Google.Apis.Plus.v1;
using Google.Apis.Plus.v1.Data;
using Google.Apis.Services;
using Google.GData.Client;
using Google.GData.Spreadsheets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
@jacobhackl
jacobhackl / gist:e36d4982ef04b6297aa9589f3ab0bace
Created April 1, 2016 15:00
Add linked server for sql server in aws rds
EXEC sp_addlinkedserver
@server=N'wradminlite', -- Linked Server Display Name
@srvproduct=N'SQL Server', -- Default to SQL Server
@provider=N'SQLNCLI', -- Use SQLNCLI
@datasrc=N''; -- VPC IP of remote server, force TCP mode
EXEC sp_addlinkedsrvlogin @rmtsrvname = 'wradminlite' -- Linked Server Display Name
, @useself = 'false' -- Do not masquerade
-- , @locallogin = '' -- Commented out to force all local users to use linked login
, @rmtuser = '' -- Remote user name
@jacobhackl
jacobhackl / gist:b987f53d9ca4d0e82b32
Created March 1, 2016 19:54
http to https rule for url rewriter in IIS (windows)
<rule name="Redirect to HTTPS" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
</rule>
@jacobhackl
jacobhackl / gist:f2db63ec20af2e13f8d2
Created October 7, 2015 15:21
.gitignore windows
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
@jacobhackl
jacobhackl / splitTempDb.sql
Last active September 1, 2015 15:42
Re-sizing TempDB for sql server
/* Re-sizing TempDB to 15 GB */
USE [master];
GO
alter database tempdb modify file (name='tempdev', size = 15GB);
GO
USE [master];