Skip to content

Instantly share code, notes, and snippets.

@vbuldakov
vbuldakov / index-fragmentation.sql
Created April 11, 2019 16:23
Indexes fragmentation
DECLARE @db_name varchar(50) = N'db_name',
@table_name varchar(250) = N'db_name.dbo.tbl_name'
SELECT IndStat.database_id,
IndStat.object_id,
QUOTENAME(s.name) + '.' + QUOTENAME(o.name) AS [object_name],
IndStat.index_id,
QUOTENAME(i.name) AS index_name,
IndStat.avg_fragmentation_in_percent,
IndStat.partition_number,
@vbuldakov
vbuldakov / k8s-delete-uers.cmd
Last active December 4, 2018 18:23
K8s delete users, contexts
kubectl config unset users.gke_project_zone_name
kubectl config unset contexts.aws_cluster1-kubernetes
kubectl config unset clusters.foobar-baz
kubectl config use-context my-cluster-name
@vbuldakov
vbuldakov / rmq-add-user.bat
Created December 3, 2018 19:13
Add RabbitMQ user
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
@vbuldakov
vbuldakov / create-user.sql
Created December 3, 2018 09:28
MS SQL Add new user
-- In master database:
-- Creates login
CREATE LOGIN user1
WITH PASSWORD = 'secretpassword';
GO
-- In user's database:
-- Creates user
CREATE USER user1 FROM LOGIN user1;
GO