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
/// <summary> | |
/// Three ways using DI in a console application (program.cs) | |
/// </summary> | |
/* | |
csproj: | |
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.5" /> | |
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.5" /> | |
*/ | |
////////////////////////////////////////////////////////////////////////////////////////// |
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
(New-Object -ComObject Shell.Application).ShutdownWindows() |
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
{ | |
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", | |
"console_title_template": "{{if .Root}}admin :: {{end}}{{.Shell}} :: {{.Folder}}", | |
"blocks": [ | |
{ | |
"type": "prompt", | |
"alignment": "left", | |
"segments": [ | |
{ | |
"properties": { |
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
////////// | |
// .net core 3.1 (console app) | |
////////// | |
// PM> install-package System.IdentityModel.Tokens.Jwt -Version 6.11.1 | |
////////// | |
using System.IdentityModel.Tokens.Jwt; | |
using Microsoft.IdentityModel.Tokens; | |
namespace jwtValidation |
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
############################################################## | |
# The .gitconfig read by git, placed in the user home folder, | |
# e.g. c:\users\[username]\.gitconfig on windows | |
############################################################## | |
[include] | |
path = ~/git-base.conf | |
[includeIf "gitdir:D:/Develop/Customer_1/repos/"] | |
path = ~/git-customer1.conf |
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
# Get installed version .NET 4.x | |
Get-ItemProperty "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" | |
# Get last boot time | |
(Get-CimInstance -ClassName win32_operatingsystem).LastBootUpTime | |
# Get Win OS info | |
Get-CimInstance -ClassName win32_operatingsystem | select * |
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
#r "Newtonsoft.Json" | |
using System.Net; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.Primitives; | |
using Newtonsoft.Json; | |
using System.Net.Http.Headers; | |
using Microsoft.Graph; | |
using Microsoft.IdentityModel.Clients.ActiveDirectory; |
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
USE -- Db name goes here | |
GO | |
SELECT SCHEMA_NAME(A.schema_id) + '.' + | |
A.Name, AVG(B.rows) AS 'RowCount' | |
FROM sys.objects A | |
INNER JOIN sys.partitions B ON A.object_id = B.object_id | |
WHERE A.type = 'U' | |
GROUP BY A.schema_id, A.Name | |
ORDER BY A.schema_id, A.Name |
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
var getToken = function(iotHubName, key, keyName) { | |
var expiry = Math.floor(new Date().getTime() / 1000) + 3600 * 24; // 24 h expiry | |
var uri = iotHubName + ".azure-devices.net"; | |
var hmacer = new jsSHA("SHA-256", "TEXT"); // This is from https://github.com/Caligatio/jsSHA/releases/tag/v2.0.1 | |
hmacer.setHMACKey(key, "B64"); | |
hmacer.update(encodeURIComponent(uri) + "\n" + expiry); | |
var sig = hmacer.getHMAC("B64"); |
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
write-host @" | |
ββ Welcome ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
βββββββββββ βββββββββββ βββββββββββ ββββββββββ ββββββββββ βββββββββββ | |
βββββββββββββββββββββββββββββββββββββββββββββββββββ ββββββββββββ βββββββββββββ | |
ββββββββββββ βββββββββββ ββββββββββββ βββββββββββββββββββββββββββββββββββββββ | |
βββ βββ βββ βββ ββββββ ββββββ βββ | |
ββββββββββββ βββ ββββββββββββ βββ ββββββ ββββββ βββ | |
βββββββββββββ βββ ββββββββββββββββ ββββββ ββββββ βββ | |
ββββββββββββ βββ ββββββββββββ βββ ββββββ ββββββ βββ |