Skip to content

Instantly share code, notes, and snippets.

View samirbehara-zz's full-sized avatar

Samir Behara samirbehara-zz

View GitHub Profile
def test_kubernetes_node_status_is_ready(k8s_client):
nodelist = k8s_client.list_node()
# Iterate through all the nodes and verify that they are Active
for item in nodelist.items:
node = k8s_client.read_node_status(name=item.metadata.name)
print("%s\t" % item.metadata.name)
def test_kubernetes_master_components_are_healthy(k8s_client):
ret = k8s_client.list_component_status()
# Iterate through the K8s Master components in the cluster and verify if the components are reporting healthy
for item in ret.items:
assert item.conditions[0].type == "Healthy" # Verify status of Scheduler, Controller and Etcd
print("%s\t%s\t" % (item.metadata.name, item.conditions[0].type))
-- Drop the table and user(if they exist)
DROP TABLE IF EXISTS dbo.Customer
DROP USER IF EXISTS TestUser
--------------------------------------------------------------------------------------------------
-- Create table with different masking functions
CREATE TABLE dbo.Customer
(
CustomerID INT IDENTITY PRIMARY KEY,
// Install Minikube
brew cask install minikube
// Verify that minikube is properly installed
minikube version
// Install the Kubernetes Command Line Utility - kubectl
brew install kubectl
// Start Minikube
DECLARE @tracefile VARCHAR(256)
SELECT @tracefile = CAST(value AS VARCHAR(256))
FROM ::fn_trace_getinfo(DEFAULT)
WHERE traceid = 1
AND property = 2 -- filename property
SELECT *
FROM ::fn_trace_gettable(@tracefile, DEFAULT) trc
INNER JOIN sys.trace_events evt ON trc.EventClass = evt.trace_event_id
WHERE trc.EventClass IN (102, 103, 104, 105, 106, 108, 109, 110, 111)
@samirbehara-zz
samirbehara-zz / List of all Security Audit Events from SQL Default Trace
Last active December 5, 2017 01:49
List of all Security Audit Events from SQL Default Trace
--List all Security Audit Events
DECLARE @id INT;
SELECT @id = id
FROM sys.traces
WHERE is_default = 1;
SELECT DISTINCT eventid AS 'EventID' ,
name AS 'Event Name'
FROM fn_trace_geteventinfo(@id) GEI
-- Identifying Unused Indexes in SQL Server
SELECT OBJECT_NAME(s.[object_id]) AS [Table Name] ,
i.name AS [Index Name] ,
i.fill_factor ,
user_updates AS [Total Writes] ,
user_seeks + user_scans + user_lookups AS [Total Reads] ,
user_updates - ( user_seeks + user_scans + user_lookups ) AS [Difference]
FROM sys.dm_db_index_usage_stats AS s WITH ( NOLOCK )
INNER JOIN sys.indexes AS i WITH ( NOLOCK ) ON s.[object_id] = i.[object_id]
AND i.index_id = s.index_id
SELECT DISTINCT CONVERT(DECIMAL(18, 2) , user_seeks * avg_total_user_cost * ( avg_user_impact * 0.01 )) AS [index_advantage] ,
migs.last_user_seek ,
mid.[statement] AS [Database.Schema.Table] ,
mid.equality_columns ,
mid.inequality_columns ,
mid.included_columns ,
migs.unique_compiles ,
migs.user_seeks ,
migs.avg_total_user_cost ,
migs.avg_user_impact ,
DROP TABLE IF EXISTS dbo.EmployeeSkills
--Create a sample table
CREATE TABLE dbo.EmployeeSkills
(
EmployeeID INT IDENTITY PRIMARY KEY,
FirstName VARCHAR(50),
Email VARCHAR(50),
Skills VARCHAR(100)
-- String splitting function
SELECT * FROM STRING_SPLIT('SQL SERVER 2016 ROCKS', ' ')