Skip to content

Instantly share code, notes, and snippets.

View jiimaho's full-sized avatar
🎯
Focusing

Jim Aho jiimaho

🎯
Focusing
View GitHub Profile
@jiimaho
jiimaho / gist:3aa25944b576edab097ce9bdf223729e
Last active March 15, 2017 07:58
SQL Server restore database from network drive to external disk
-- allow changes to advanced options
EXEC sp_configure 'show advanced options', 1
GO
-- Update currently configured values for advanced options.
RECONFIGURE
GO
-- To enable xp_cmdshell
EXEC sp_configure 'xp_cmdshell', 1
GO
-- Update currently configured values for advanced options.
@jiimaho
jiimaho / git-to-file.ps1
Last active March 21, 2018 08:51
Write a short version of the lastest git commit message to a text file
git log -1 --pretty=format:"%h (%an) [%ad] : %s" --date=short > path\file.txt
@jiimaho
jiimaho / add-git-log-alias.ps1
Created March 23, 2018 15:04
Pretty git log alias
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
git config --global core.editor "'C:\Program Files\Sublime Text 3\subl.exe' -w"
[user]
email = a@b.com
name = Chuck Norris
[core]
editor = 'C:\\Program Files\\Sublime Text 3\\subl.exe' -w
[alias]
st = status
c = commit -v
ca = commit --amend
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
Get-ChildItem C:\ -recurse -include "aaa.exe", "bbb.exe"
# Credit: https://stackoverflow.com/a/49110679/2874896
@jiimaho
jiimaho / remove-dir-and-obj-folders.ps1
Last active December 10, 2018 10:17
powershell remove dir and obj
function hardClean {
try {
Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) {
Write-Output "Deleting $_"
remove-item $_.FullName -Force -Recurse
}
}
catch {
Write-Output "error"
}
@jiimaho
jiimaho / SlackNotificationOctopusDeploy.ps1
Last active January 17, 2019 11:06
Octopus script template for slack notifiation with release notes and deployment link
function Slack-Rich-Notification ($notification)
{
$payload = @{
channel = $OctopusParameters['Channel']
username = $OctopusParameters['Username'];
icon_url = $OctopusParameters['IconUrl'];
attachments = @(
@{
fallback = $notification["fallback"];
color = $notification["color"];
@jiimaho
jiimaho / Startup.cs
Last active December 15, 2019 17:37
services.AddSpaStaticFiles(
configuration =>
{
configuration.RootPath = "wwwroot"; // Or any other folder
});