Here is how you can emulate Azure managed identity on your local system by running an instance metadata service identity endpoint and simulating the token API to return an access token from Azure CLI. You can use this for example to log into SQL Server Management studio using your Azure CLI identity, or locally test code that uses the "Azure only" [ManagedIdentityCredential](https://learn
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
create function dbo.ParseSemVerString | |
( | |
-- a semantic version number string that meets specification described here: http://semver.org/ | |
@versionString NVARCHAR(300) | |
) | |
returns @T table(Major int, Minor int, Patch int, PreReleaseLabel nvarchar(200), BuildLabel nvarchar(200)) | |
as | |
begin | |
declare @segmentDelimiter char(1) |
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
$assembly = [System.Reflection.Assembly]::LoadFrom("$env:systemroot\system32\inetsrv\Microsoft.Web.Administration.dll") | |
$manager = new-object Microsoft.Web.Administration.ServerManager | |
# load appHost config | |
$config = $manager.GetApplicationHostConfiguration() | |
Write-Host "Unlocking system.webServer/handlers" | |
$section = $config.GetSection('system.webServer/handlers') | |
$section.OverrideMode = 'Allow' | |
$manager.CommitChanges() | |
Write-Host "Unlocked system.webServer/handlers" |
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
internal static class FormsAuthenticationTicketHelper | |
{ | |
private const byte CURRENT_TICKET_SERIALIZED_VERSION = 0x01; | |
private const int MAX_TICKET_LENGTH = 4096; | |
// Resurrects a FormsAuthenticationTicket from its serialized blob representation. | |
// The input blob must be unsigned and unencrypted. This function returns null if | |
// the serialized ticket format is invalid. The caller must also verify that the | |
// ticket is still valid, as this method doesn't check expiration. |
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
class SerilogMiddleware | |
{ | |
const string MessageTemplate = | |
"HTTP {RequestMethod} {RequestPath} {InterimStatusCode} status code {StatusCode} in {Elapsed:0.0000} ms"; | |
private readonly ILogger Log; // global::Serilog.Log.ForContext<SerilogMiddleware>(); | |
readonly RequestDelegate _next; | |
public SerilogMiddleware(RequestDelegate next, ILogger logger) |
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
Get-ChildItem -recurse *tests.csproj | % { Start-Process -FilePath 'dotnet' -NoNewWindow -ArgumentList "watch", "--project="$($_.FullName)"", "test";if($? -ne $TRUE) {throw 'Unit Test Failure.'} } |
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
choco install nuget.commandline | |
$PackageId = "xxx" | |
$ApiKey = "yyy" | |
$json = Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/$PackageId/index.json" | ConvertFrom-Json | |
foreach($version in $json.versions) | |
{ | |
Write-Host "Unlisting $PackageId, Ver $version" |
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
# Starter pipeline | |
# Start with a minimal pipeline that you can customize to build and deploy your code. | |
# Add steps that build, run tests, deploy, and more: | |
# https://aka.ms/yaml | |
trigger: | |
- master | |
pool: | |
vmImage: 'windows-latest' |
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
# | |
# Instructions for quick gluster server (1 node) setup with a volume on LVM. | |
# No replication, just using localhost. | |
# | |
# See https://docs.gluster.org/en/latest/Administrator%20Guide/Brick%20Naming%20Conventions/ | |
# | |
# Install GlusterFS | |
add-apt-repository ppa:gluster/glusterfs-4.0 | |
apt-get install glusterfs-server |
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
version: '3.8' | |
configs: | |
loki-conf: | |
file: ./loki.conf | |
fluent-bit-conf: | |
file: ./fluent-bit.conf | |
networks: | |
monitoring: |