Skip to content

Instantly share code, notes, and snippets.

Andrew Kramarev akramarev

View GitHub Profile
View git-local-cleanup
git remote prune origin
git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -d
View kill-sessions.sql
DECLARE @kill varchar(8000) = '';
SELECT @kill = @kill + 'kill ' + CONVERT(varchar(5), session_id) + ';'
FROM sys.dm_exec_sessions
WHERE
database_id = db_id('DBUser')
AND login_name IN ('DBTest', 'DBServices')
EXEC(@kill);
View git-on-windows.bat
git config --global core.preloadindex true
git config --global core.fscache true
git config --global gc.auto 256
@akramarev
akramarev / update-udp.sql
Created Jun 24, 2017
Update UDT MSSQL User Defined Types
View update-udp.sql
DECLARE @Name NVARCHAR(776) = NULL;
EXEC sys.sp_rename 'dbo.MyUDT', 'zMyUDT';
GO
CREATE TYPE [dbo].[MyUDT] AS TABLE
(
[HierarchyId] [int] NOT NULL
)
GO
@akramarev
akramarev / new_gist_file.ps1
Last active Jan 29, 2016
Windows disk space, allocation, directories size
View new_gist_file.ps1
Get-ChildItem | Where-Object { $_.PSIsContainer } | ForEach-Object { $_.Name + ": " + "{0:N2}" -f ((Get-ChildItem $_ -Recurse | Measure-Object Length -Sum -ErrorAction SilentlyContinue).Sum / 1MB) + " MB" }
View install-docker.sh
wget -qO- https://get.docker.io/gpg | sudo apt-key add -
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
sudo apt-get update
sudo apt-get install lxc-docker
You can’t perform that action at this time.