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
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) |
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
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)) | |
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
-- 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, |
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
// 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 |
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
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) |
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
--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 |
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
-- 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 |
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 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 , |
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
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) |
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
-- String splitting function | |
SELECT * FROM STRING_SPLIT('SQL SERVER 2016 ROCKS', ' ') |