Skip to content

Instantly share code, notes, and snippets.

View mikesigs's full-sized avatar
😁

Mike Sigsworth mikesigs

😁
View GitHub Profile
@mikesigs
mikesigs / AddSelfAsSqlAdmin.bat
Created July 30, 2019 01:11
Add Self as SQL Admin on local instance
@echo off
rem
rem ****************************************************************************
rem
rem Copyright (c) Microsoft Corporation. All rights reserved.
rem This code is licensed under the Microsoft Public License.
rem THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
rem ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
rem IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
rem PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
@mikesigs
mikesigs / cloudSettings
Created February 9, 2018 03:11
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-02-09T03:11:48.470Z","extensionVersion":"v2.8.7"}
@mikesigs
mikesigs / 1 - PowerShell Customization.md
Last active October 12, 2021 15:25 — forked from jchandra74/PowerShell Customization.md
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

http://slickdeals.net/forums/showpost.php?p=6480998&postcount=1
Vista Blocked Programs at Startup- Fix Once and for All
I have the VISTA HOME Premium and like the VISTA Basic I do not have Security Policy Control on my non-VISTA Apps. Mad If you have Windows Vista Ultimate then you do. So here is a way too once and for all to fix that VISTA tray BLOCKED APP alert that is quite annoying in that you are alerted with every bootup that your app is blocked and you must allow the app to run each time by giving VISTA permission blessing. Boo on that. So here is the fix:
Remove the startup app that is offending by:
Start----Run----and type in msconfig.exe
Go to STARTUP Tab and remove the app that is blocked by Vista noting on a sheet of paper where the program is run from. If the program app is run from the startup menu, then just go to Start---All Program Files---Startup Folder and remove the app there.
@mikesigs
mikesigs / SQL_Date_Conversions.sql
Created April 26, 2016 17:48
SQL Date Conversions
/* *** SQL Server Date Calculations *** */
-- First day of prior month
SELECT DATEADD(mm, DATEDIFF(mm,0,DATEADD(mm,-1-DATEPART(day,GetDate()),GetDate())),0) /*first day of prior month*/
-- Last month
SELECT CAST(DATEPART(m, GetDate())-1 AS INT) /*last month*/
-- Current year
SELECT CAST(DATEPART(yyyy, GetDate())AS INT) /*current year*/
-- Current day
SELECT CAST(DATEPART(dd, GetDate())AS INT) /*current day*/
-- First day of current year
@mikesigs
mikesigs / LCD.cs
Last active April 22, 2016 19:37
Lowest Common Denominator
void Main()
{
var input = new long[,] { {1, 2}, {1, 3}, {1, 4} };
var fractions =
from i in Enumerable.Range(0, input.GetUpperBound(0) + 1)
select Tuple.Create(input[i,0], input[i,1]);
var denoms = fractions.Select(t => t.Item2).ToArray();
@mikesigs
mikesigs / replace_root.sh
Created March 24, 2016 20:30 — forked from pmiossec/replace_root.sh
Script to permit to rcheckin a git repository to a newly created TFVC repository with git-tfs
#Script to permit to rcheckin a git repository to a newly created TFVC repository with git-tfs
#adaptation from my answer: http://stackoverflow.com/questions/645450/insert-a-commit-before-the-root-commit-in-git/30558271#30558271
#usage: pass to the script (1) the url of the tfs server, (2) the tfs path in the repository, (3) the changeset id
#../replace_root.sh "https://urlOfYourTfs/DefaultCollection" "$/EmptyTfs/Trunk" 21
# Command to get Changeset ID
# tf history "$/EmptyTfs/Trunk" /collection:"https://urlOfYourTfs/DefaultCollection" /noprompt /stopafter:1
# Clean up any previous attempt
rm -rf ./.git/refs/replace
@mikesigs
mikesigs / build.fsx
Created March 18, 2016 20:09
F# Suave Build Script
// --------------------------------------------------------------------------------------
// A simple FAKE build script that:
// 1) Hosts Suave server locally & reloads web part that is defined in 'app.fsx'
// 2) Deploys the web application to Azure web sites when called with 'build deploy'
//
// Source: https://github.com/tpetricek/suave-xplat-gettingstarted/blob/master/build.fsx
// --------------------------------------------------------------------------------------
#r "packages/FSharp.Compiler.Service/lib/net45/FSharp.Compiler.Service.dll"
#r "packages/Suave/lib/net40/Suave.dll"
#r "packages/FAKE/tools/FakeLib.dll"
@mikesigs
mikesigs / NonEF_DatabaseFixture.cs
Last active February 19, 2016 23:06
xUnit2 DatabaseFixture that Drops and Creates LocalDb
public class DatabaseFixture
{
private readonly string DataDirectory = AppDomain.CurrentDomain.BaseDirectory;
private const string DatabaseName = "TestDb";
private const string DbFilename = DatabaseName + ".mdf";
private const string DbLogFilename = DatabaseName + "_log.ldf";
private const string TestDbConnectionStringName = "TestDb";
private const string MasterDbConnectionStringName = "MasterDb";
private string DbPath => Path.Combine(DataDirectory, DbFilename);
private string DbLogPath => Path.Combine(DataDirectory, DbLogFilename);
@mikesigs
mikesigs / DependenciesVisualizer.linq
Created February 2, 2016 16:48 — forked from plaurin/DependenciesVisualizer.linq
LinqPad query to generate a DMGL of projects, libraries and NuGet packages dependencies
<Query Kind="Program" />
private string[] projectExtensionExclusions = new[] { ".vdproj", ".ndproj", ".wdproj", ".shfbproj" };
private string rootFolder = @"C:\Users\Pascal\Dev\MyProject";
void Main()
{
LoadAllProjects();
LoadAllPackagesConfig();
GenerateDGML(Path.Combine(rootFolder, "Dependencies.dgml"));