Skip to content

Instantly share code, notes, and snippets.

View freemanirl's full-sized avatar

Brandon Freeman freemanirl

  • Something Utility
  • Grand Rapids, MI
View GitHub Profile
@freemanirl
freemanirl / Db_Show_plan.sql
Created February 23, 2018 21:20
Generate plan text for all dbs and views in a schema
SET NOCOUNT ON
GO
PRINT 'SET SHOWPLAN_TEXT ON'
PRINT 'GO'
DECLARE @query nvarchar(max)
DECLARE cur CURSOR FOR
SELECT 'SELECT * FROM [' + sys.schemas.name + '].[' + sys.objects.name + ']' AS [--stmt]
@freemanirl
freemanirl / kill.sql
Created January 4, 2018 14:47
Kill tsql processes
declare @result table (
[SPID] int,
[Status] nvarchar(50),
[Login] nvarchar(50),
[HostName] nvarchar(50),
[BlkBy] nvarchar(50),
[DBName] nvarchar(50),
[Command] nvarchar(100),
[CPUTime] int,
[DiskIO] int,
@freemanirl
freemanirl / xbox_360_two_red.txt
Created June 21, 2017 13:14
Diagnose 2 red lights on Xbox 360
Hold the sync button on the console and press the eject button. This will give you some rapidly
flashing red lights. Make note of how many quadrants are doing this. Repeat this 3 more times to
obtain a 4 digit sequence.
Four rapidly flashing quadrants = a numerical 0
Three rapidly flashing quadrants = a numerical 3
Two rapidly flashing quadrants = a numerical 2
One rapidly flashing quadrant = a numerical 1
With the 2 flashing red lights, you will most likely get 0011 (CPU), 0012 (GPU), or 0013 (RAM).
@freemanirl
freemanirl / sudo.rc
Created May 12, 2017 14:07
Sudo for Cygwin
alias sudo="cygstart --action=runas"
@freemanirl
freemanirl / gitclean.sh
Created May 2, 2017 20:26
Git Delete Merged Local Branches
git branch --merged | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d
@freemanirl
freemanirl / get_workers.sql
Created May 1, 2017 17:10
Get T-Sql Workers
DECLARE @Table TABLE(
SPID INT,
Status VARCHAR(MAX),
LOGIN VARCHAR(MAX),
HostName VARCHAR(MAX),
BlkBy VARCHAR(MAX),
DBName VARCHAR(MAX),
Command VARCHAR(MAX),
CPUTime INT,
DiskIO INT,
@freemanirl
freemanirl / phone.regex
Created April 13, 2017 12:46
Regex - Phone
^\+?[\d]{0,2}?(\ |-|\.)?\(?[\d]{3}\)?(\ |-|\.)?[\d]{3}(\ |-|\.)?[\d]{4}$
@freemanirl
freemanirl / ple.sql
Created April 5, 2017 18:19
Find Page Life Expectancy
SELECT [object_name],
[counter_name],
[cntr_value] FROM sys.dm_os_performance_counters
WHERE [object_name] LIKE '%Manager%'
AND [counter_name] = 'Page life expectancy'
@freemanirl
freemanirl / slow_queries.sql
Created April 5, 2017 12:41
T-Sql Slow Queries
SELECT
creation_time,
last_execution_time,
total_physical_reads,
total_logical_reads,
total_logical_writes,
execution_count,
total_worker_time,
total_elapsed_time,
total_elapsed_time / execution_count avg_elapsed_time,
@freemanirl
freemanirl / gist:6f3a8e530f51f707ed6c7a155fc589fb
Created March 1, 2017 23:08 — forked from celly/gist:c4ea2ebc2957059c138e
Printrbot Simple Metal start gcode
Found in this post: https://www.reddit.com/r/PrintrBot/comments/3jm8bc/start_gcode_does_not_extrudeandmove_but_the_code/
Use this to reset, center, and auto-extrudea small bit before printing.
G90 ; Explicitly force absolute positioning in case it was not reset previously.
G28 ; Home all axes.
G29 ; Auto-level the bed.
G0 X0 Y0 Z0.15 F9000 ; Move to the front-left part of the bed.
M109 S{print_temperature} ; Set and wait for extruder temperature.
G92 E0 ; Zero the extruder.