This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Misc good to have commands when using git | |
# | |
# Setup user | |
git config --global user.name "First Last" | |
git config --global user.email first.last@domain.com | |
# Setup useful aliases | |
git config --global alias.ci commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT s.name, o.name, o.type, o.type_desc, s.schema_id | |
FROM sys.objects AS o | |
INNER JOIN sys.schemas AS s ON o.schema_id = s.schema_id | |
WHERE s.name NOT IN ( 'dbo', 'sys' ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Count rows in all tables, display tables with rows | |
-- | |
CREATE TABLE #T ( | |
name NVARCHAR(255), | |
[rows] INT, | |
reserved NVARCHAR(255), | |
data NVARCHAR(255), | |
index_size NVARCHAR(255), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Remove non dbo tables, views and stored procedures | |
-- | |
BEGIN TRANSACTION | |
DECLARE @Cmd NVARCHAR(max); | |
DECLARE [CmdCursor] CURSOR FAST_FORWARD READ_ONLY FOR | |
SELECT 'DROP TABLE [' + s.name + '].[' + t.name + '];' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Select the tables, views and stored procedures that are not in the [dbo] schema | |
-- | |
-- Useful when double checking that prople has not run scripts with the wrong user | |
-- for databases that have everything in the [dbo] schema. | |
-- | |
SELECT 'Table' AS [Type] , | |
'[' + s.name + '].[' + t.name + ']' AS [Name] | |
FROM sys.tables AS t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Count rows in all tables, display tables with rows | |
-- | |
CREATE TABLE #T ( | |
name NVARCHAR(255), | |
[rows] INT, | |
reserved NVARCHAR(255), | |
data NVARCHAR(255), | |
index_size NVARCHAR(255), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[diff] | |
guitool = BeyondCompare3 | |
[difftool "BeyondCompare3"] | |
path = C:/Program Files/Beyond Compare 3/bcomp.exe | |
cmd = \"C:/Program Files/Beyond Compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\" | |
[merge] | |
tool = BeyondCompare3 | |
[mergetool "BeyondCompare3"] | |
path = C:/Program Files/Beyond Compare 3/bcomp.exe | |
cmd = \"C:/Program Files/Beyond Compare 3/bcomp.exe\" \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-FileEncoding($Path) { | |
$bytes = [byte[]](Get-Content $Path -Encoding byte -ReadCount 4 -TotalCount 4) | |
if(!$bytes) { return 'utf8' } | |
switch -regex ('{0:x2}{1:x2}{2:x2}{3:x2}' -f $bytes[0],$bytes[1],$bytes[2],$bytes[3]) { | |
'^efbbbf' { return 'utf8' } | |
'^2b2f76' { return 'utf7' } | |
'^fffe' { return 'unicode' } | |
'^feff' { return 'bigendianunicode' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Run-Exe() { | |
$Executable = $args[0] | |
$Arguments = @( $args | Select -Skip 1 ) | |
Write-Host "RUNNING COMMAND: $Executable $Arguments" | |
$Output = & $Executable @Arguments 2>&1 | |
if ($LASTEXITCODE) { | |
Write-Error "COMMAND FAILED: $Executable $Arguments`nExit code = $LASTEXITCODE`nOutput = $Output" | |
throw "COMMAND FAILED: $Executable $Arguments`nExit code = $LASTEXITCODE`nOutput = $Output" | |
} | |
Write-Host "COMMAND OUTPUT: $Output" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Before - setup environment (PowerShell syntax): | |
$env:_NT_SYMBOL_PROXY = "webproxy.mycompany.com:8080" | |
# Start NTSD | |
& 'C:\Program Files\Debugging Tools for Windows (x64)\ntsd.exe' -p <pid> | |
& 'C:\Program Files\Debugging Tools for Windows (x64)\ntsd.exe' -z <dumpfile> | |
# Fix symbol path | |
.symfix | |
# Reload symbols |
OlderNewer