Skip to content

Instantly share code, notes, and snippets.

@seanlinsley
seanlinsley / seeyouspacecowboy.rb
Last active August 30, 2020 23:46
A Ruby verison, because the ANSI colors weren't showing up on logout in the Shell version this is forked from
#!/usr/bin/env ruby
# SEE YOU SPACE COWBOY by DANIEL REHN (danielrehn.com)
# Displays a timeless message in your terminal with cosmic color effects
# Usage: add `ruby ~/seeyouspacecowboy.rb; sleep 2` to .bash_logout (or similar) in your home directory
# (adjust the sleep variable to display the message for more seconds)
class String
def colorize(color_code)
@jasonmead
jasonmead / unused_indexes.sql
Created August 15, 2012 20:36
Unused indexes
SELECT OBJECT_SCHEMA_NAME(I.OBJECT_ID) AS SchemaName,
OBJECT_NAME(I.OBJECT_ID) AS ObjectName,
I.NAME AS IndexName
FROM sys.indexes I
WHERE -- only get indexes for user created tables
OBJECTPROPERTY(I.OBJECT_ID, 'IsUserTable') = 1
-- find all indexes that exists but are NOT used
AND NOT EXISTS (
SELECT index_id
FROM sys.dm_db_index_usage_stats