View uninstall-mssql.ps1
# Powershell script to uninstall all Microsoft SQL Server stuff.
# There's so many entries it's a pain to uninstall everything manually. Run via PowerShell (or PowerShell ISE) as Admin.
# Warning: this still prompts for confirmation on a bunch of items.
$uninstall32 = gci "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | foreach { gp $_.PSPath } | ? { $_ -match "SQL Server" } | select DisplayName,UninstallString
$uninstall64 = gci "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | foreach { gp $_.PSPath } | ? { $_ -match "SQL Server" } | select DisplayName,UninstallString
$uninstall = $uninstall32 + $uninstall64 | where {$_.UninstallString -match "MsiExec"} | Sort DisplayName
View gist:43124c78a8a5c4866bbd0ccf9821fe77
### Keybase proof
I hereby claim:
* I am gregmac on github.
* I am gregmac (https://keybase.io/gregmac) on keybase.
* I have a public key ASBOl8fdnaaIZeRYR8GqeKB2oBereEq6at1bjvcDvYHzVwo
To claim this, I am signing this object:
View reclaimWindows10.ps1
##########
# Win10 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: 1.7, 2016-08-15
# Run as admin:
#
# (New-Object System.Net.WebClient).DownloadString("https://gist.github.com/gregmac/c8cf9fe7e48d0e9a15c985674b9861d9/raw") | iex
#
View NullCheckExtensions.cs
public static class NullCheckExtensions
{
public static bool IsNullOrEmpty(this string value) => string.IsNullOrEmpty(value);
public static bool IsNullOrWhitespace(this string value) => string.IsNullOrWhiteSpace(value);
public static bool IfNotNull<T>(this T value, Action<T> trueAction)
{
if (value == null) return false;
View usermacro.html
## Macro title: UML Sequence Diagram
## Macro has a body: Y
## Body processing: Unrendered
##
## This macro allows use of js-sequence-diagrams from http://bramp.github.io/js-sequence-diagrams/
##
## Developed by: Greg MacLellan
## Date created: 2015-09-15
## 2015-09-21: Added suppor for displaying parse errors while rendering
## Installed by: Greg MacLellan
View gist:977437ce7fd49d7a0475

For my own reference, settings that are necessary to make Windows 8/8.1 nice.

Start menu

StartIsBack or Start8. Either work, and this is absolutely essential.

Disable forced auto-update

This inevitably happens during something important. Glad to see MS forces updates -- but... I will restart when I restart.

View signtool.msbuild.tasks
<!--
Sign .exe files using signtool.exe.
(c) 2014 Greg MacLellan, Licensed under MIT http://opensource.org/licenses/MIT
Features:
* Hides password from being displayed in build output
* Retries against multiple timestamp servers if the server returns an invalid response (fairly common)
Usage:
View jira-paste-tablizied.js
/*
Listens for a paste event into a JIRA wiki textarea
If there is at least one tab and newline in the pasted text,
and then every line contains the same number of tabs,
it is turned into a table using JIRA wiki markup syntax.
By Greg MacLellan, 2014-04-09. BSD License.
*/
jQuery('textarea.wiki-textfield').live('paste', function() {
var self = jQuery(this);
var originalText = self.val();
View gist:10157265
-- Returns the same results of MS SQL Server sp_spaceused, but in a single result set
select
-- from first result set of 'exec sp_spacedused'
db_name() as [database_name]
,ltrim(str((convert (dec (15,2),sf.dbsize) + convert (dec (15,2),sf.logsize)) * 8192 / 1048576,15,2) + ' MB') as [database_size]
,ltrim(str((case when sf.dbsize >= pages.reservedpages then
(convert (dec (15,2),sf.dbsize) - convert (dec (15,2),pages.reservedpages))
* 8192 / 1048576 else 0 end),15,2) + ' MB') as [unallocated space]
View SingleCall.cs
/// <summary>
/// Creates a wrapper that ensures a passed method can only be invoked once, even if
/// called on multiple threads. If invocation has already started by another thread,
/// blocks until that the actual call is complete.
/// </summary>
public class SingleCall
{
private readonly object _lock = new object();
private bool called = false;