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
<# | |
.Synopsis | |
Automates the TLS Enablement of RabbitMQ. | |
.DESCRIPTION | |
This script will use provided certs to create the TLS configuration for the RabbitMQ. Unless provided will generate the selfsigned certficate to do so.This script uses OpenSSL to generate certficates and test SSl. | |
If not installed the script will download and install OpenSSL. | |
.PARAMETER RabbitMQver | |
The version of the RabbitMQ installed at "C:\Program Files\RabbitMQ Server\" to manipulate the service. | |
.PARAMETER CA | |
The certficate authority chain to be used. |
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
const string CLIENT_ID = "MY AzureAD App Registration Application (Client) Id"; | |
const string CLIENT_SECRET = "My AzureAD App Registration Application Secret"; | |
static KeyVaultClient GetClient() => new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(async (string authority, string resource, string scope) => | |
{ | |
var context = new AuthenticationContext(authority, TokenCache.DefaultShared); | |
ClientCredential clientCredential = new ClientCredential(CLIENT_ID, CLIENT_SECRET); | |
var authResult = await context.AcquireTokenAsync(resource, clientCredential); | |
return authResult.AccessToken; | |
})); |
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
openssl x509 -outform der -in public_key.pem -out public_key.crt |
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
openssl pkcs12 -inkey private_key.pem -in public_key.pem -export -out private_key.pfx |
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
req -x509 -newkey rsa:4096 -keyout private_key.pem -out public_key.pem -days 365 -nodes -subj '/CN=localhost' |
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
WITH CTE | |
AS (SELECT FirstNames, | |
Surname, | |
ROW_NUMBER() OVER (PARTITION BY FirstNames, Surname ORDER BY FirstNames, Surname) AS RowNum | |
FROM #STUDENTS) | |
DELETE FROM CTE | |
WHERE CTE.RowNum > 1; |
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
WITH CTE | |
AS (SELECT FirstNames, | |
Surname, | |
ROW_NUMBER() OVER (PARTITION BY FirstNames, Surname ORDER BY FirstNames, Surname) AS RowNum | |
FROM #STUDENTS) | |
SELECT CTE.FirstNames, | |
CTE.Surname, | |
CTE.RowNum | |
FROM CTE; |
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 DISTINCT | |
FirstNames, | |
Surname | |
INTO #STUDENTS_TEMP | |
FROM #STUDENTS; | |
DELETE FROM #STUDENTS; | |
INSERT INTO #STUDENTS | |
( | |
FirstNames, | |
Surname |
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
CREATE TABLE #STUDENTS | |
( | |
FirstNames VARCHAR(50) NOT NULL, | |
Surname VARCHAR(50) NOT NULL | |
); | |
INSERT INTO #STUDENTS | |
( | |
FirstNames, | |
Surname |
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 Region, | |
FORMAT([Quarter], 'yyyy') + ' Q' + CONVERT(VARCHAR(1), DATEPART(qq, [Quarter])) AS [Quarter], | |
LAG(TotalSales, 1, NULL) OVER (PARTITION BY Region ORDER BY Quarter ASC) AS [Previous Quarter Sales], | |
TotalSales AS [Quarter Sales], | |
LEAD(TotalSales, 1, NULL) OVER (PARTITION BY Region ORDER BY Quarter ASC) AS [Next Quarter Sales] | |
FROM #TempSales | |
ORDER BY [Quarter]; |
NewerOlder