This file contains hidden or 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
git fetch --prune |
This file contains hidden or 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 | |
database_name = DB_NAME(database_id) | |
, log_size_mb = CAST(SUM(CASE WHEN type_desc = 'LOG' THEN size END) * 8. / 1024 AS DECIMAL(8,2)) | |
, row_size_mb = CAST(SUM(CASE WHEN type_desc = 'ROWS' THEN size END) * 8. / 1024 AS DECIMAL(8,2)) | |
, total_size_mb = CAST(SUM(size) * 8. / 1024 AS DECIMAL(8,2)) | |
FROM sys.master_files WITH(NOWAIT) | |
--WHERE database_id = DB_ID() -- for current db | |
GROUP BY database_id |
This file contains hidden or 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
-- get a list of stored procedures | |
select * from sys.procedures | |
-- get sproc parameters names | |
SELECT name | |
FROM sys.parameters | |
WHERE object_id = OBJECT_ID('sproc name') | |
-- get sproc parameters name, type, and length | |
SELECT p.name AS ParameterName, t.name AS ParameterType, p.max_length AS ParameterLength | |
FROM sys.parameters AS p | |
JOIN sys.types AS t ON t.user_type_id = p.user_type_id |
This file contains hidden or 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
#Git push local branch to remote and track it | |
git push -u origin <branch> |
This file contains hidden or 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
#execute this after remotes branches have been deleted. | |
git fetch --all --prune |
This file contains hidden or 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
# Get changed(added or modified) files list to a text file. | |
git diff --name-only --diff-filter=AM <commit1>..<commit2> > changes.txt | |
# Create 7z archive. On windows git bash, this can also deal with file names with spaces. | |
7z a changes.7z -ir@"changes.txt" |
This file contains hidden or 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
set clipboard=unnamed | |
set guifont=Consolas:h12:cANSI | |
syntax on | |
colorscheme github |
This file contains hidden or 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
set backspace=indent,eol,start | |
set vsvim_useeditordefaults | |
set clipboard=unnamed |
This file contains hidden or 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
--size in KB | |
SELECT | |
s.Name AS SchemaName, | |
t.NAME AS TableName, | |
p.rows AS RowCounts, | |
SUM(a.total_pages) * 8 AS TotalSpaceKB, | |
SUM(a.used_pages) * 8 AS UsedSpaceKB, | |
(SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB | |
FROM | |
sys.tables t |
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
public static class LINQExtension | |
{ | |
public static IEnumerable<TSource> DistinctBy<TSource, TKey> | |
(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) | |
{ | |
HashSet<TKey> knownKeys = new HashSet<TKey>(); |
NewerOlder