Skip to content

Instantly share code, notes, and snippets.

View sgaulding's full-sized avatar

Sam Gaulding sgaulding

View GitHub Profile
@sgaulding
sgaulding / SQLRestorefromBackup.Bat
Created July 31, 2014 02:28
Command Prompt MS-SQL Restore from Backup
rem ******************************************* Use Master
SqlCmd -E -S localhost -Q "USE MASTER"
rem ******************************************* Restoring <Database Name> database
SqlCmd -E -S localhost -Q "ALTER DATABASE [<Database Name>] SET SINGLE_USER WITH ROLLBACK AFTER 5 SECONDS"
del " <Database Backup Full File Name>.bak"
@sgaulding
sgaulding / SlackPost.ps1
Created August 19, 2015 02:41
Post to Slack
$slackMessage = "Test Message"
$postSlackMessage = @{token="{token}";channel="{channel}";username="{user}";text=$slackMessage;icon_emoji=":loudspeaker:";}
Invoke-RestMethod -Uri https://slack.com/api/chat.postMessage -Body $postSlackMessage
@sgaulding
sgaulding / LogHelper.cs
Created November 9, 2016 04:22
NCrunch Log4Net Helper
// http://forum.ncrunch.net/yaf_postst1839_Including-log4net-Logging-in-Test-output.aspx
using log4net;
using log4net.Appender;
using log4net.Core;
using log4net.Layout;
using log4net.Repository.Hierarchy;
namespace Tests.Helper
{
public class Logger
@sgaulding
sgaulding / .gitcommittemplate
Created February 10, 2017 01:26
GIT Comment Template
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# You MUST wrap all lines at 72 characters.
#
# ==[ Subject: <type>(<scope>): <subject> ]======|
# ==[ Blank: Follow the Subject with a blank line, do NOT remove ]=====|
@sgaulding
sgaulding / VisualStudioClean.ps1
Last active March 15, 2017 00:39
Clean up Visual Studio directories
Get-ChildItem -inc bin,obj -rec | Remove-Item -rec -force
Get-ChildItem -inc bin,obj -rec | ? { $_.PsIsContainer -and $_.FullName -notmatch 'node_modules' } | ? { Remove-Item $_.FullName -rec -force }
Get-ChildItem -Recurse -Directory | Select-Object @{Name="Count"; Expression={(Get-ChildItem $_.FullName -File).Count}}, @{Name="Directory"; Expression={$_.FullName}}, @{Name="LastWriteTime"; Expression={$_.LastWriteTime}} | Sort-Object -Property LastWriteTime -Descending | Select-Object -First 10 | Format-Table
@sgaulding
sgaulding / CombineGitReposWithHistory.ps1
Last active January 5, 2022 19:15
PowerShell Script to combine GIT repositories and keep their history
$ErrorActionPreference = "Stop"
$repos = (
'',
''
)
$baseUrl = ''
$currentDir = ''
$tempDir = ''
@sgaulding
sgaulding / own.dg.theme
Last active October 6, 2023 11:09
SmartGit Dark Theme (SmartGit Version 17.1)
# This file lists the color values of the default dark theme.
# Each line starting with a # is a comment.
# To overwrite certain colors remove the leading # and change the color values.
# The "extends" line defines which color definitions to use if none is found here.
extends=deepgit-dark-theme.properties
# The "preferredEditorTheme" line determines what editor theme should be used by default ('light' or 'dark').
preferredEditorTheme=dark