View AwsV4SigningExample.cs
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
using System.Globalization; | |
using System.Net.Mime; | |
using System.Security.Cryptography; | |
using System.Text; | |
using Microsoft.AspNetCore.Mvc; | |
namespace EvaporateJSTest.Controllers; | |
[ApiController] | |
[Route("signAuth")] |
View mtls-policy.xml
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
<policies> | |
<inbound> | |
<base /> | |
<!-- TODO: limit by client_id, not token itself --> | |
<rate-limit-by-key calls="30" renewal-period="10" counter-key="@(context.Request.Headers.GetValueOrDefault("Authorization",""))" /> | |
<choose> | |
<when condition="@(context.Request.Certificate != null && context.Request.Certificate.NotAfter > DateTime.Now)"> | |
<set-header name="Client-Certificate" exists-action="override"> | |
<value>@(context.Request.Certificate.GetRawCertDataString())</value> | |
</set-header> |
View DbDeadlockRetryHandlerProcessor.cs
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
using System; | |
using System.Data.Common; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using MediatR; | |
namespace Foo | |
{ | |
public class DbDeadlockRetryHandlerProcessor<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> | |
{ |
View Builder.cs
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
using System; | |
using System.Collections.Generic; | |
namespace builder | |
{ | |
/// <summary> | |
/// MainApp startup class for .NET optimized | |
/// Builder Design Pattern. | |
/// </summary> | |
public class MainApp |
View AsyncConsoleAppWithCancellationTokenSupport-Legacy.cs
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
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace ConsoleApp | |
{ | |
class Program | |
{ | |
// Cancellation Tokens - https://docs.microsoft.com/en-us/previous-versions/dd997289(v=vs.110) | |
private static readonly CancellationTokenSource canToken = new CancellationTokenSource(); |
View azcopy-script.ps1
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
# POST method: $req | |
$requestBody = Get-Content $req -Raw | ConvertFrom-Json | |
$name = $requestBody.name | |
# GET method: each querystring parameter is its own variable | |
if ($req_query_name) | |
{ | |
$name = $req_query_name | |
} |
View LinkedIn - Remove crap posts.js
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
const removeCrap = () => { | |
const $crapSelector = $(` | |
span.ember-view span:contains(" likes this"), | |
span.ember-view span:contains(" commented on this"), | |
span.ember-view span:contains(" liked "), | |
span.ember-view span:contains("Short course you may like"), | |
div.feed-shared-text-view span:contains("Promoted") | |
`); | |
const crapCount = $crapSelector.length; |
View LinkedIn - Remove crap posts.js
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
const removeCrap = () => { | |
const $crapSelector = $(` | |
span.ember-view span:contains(" likes this"), | |
span.ember-view span:contains(" commented on this"), | |
span.ember-view span:contains(" liked "), | |
span.ember-view span:contains("Short course you may like"), | |
div.feed-shared-text-view span:contains("Promoted") | |
`); | |
const crapCount = $crapSelector.length; |
View deferred-promise.ts
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
/** | |
* A new instance of deferred is constructed by calling `new DeferredPromse<T>()`. | |
* The purpose of the deferred object is to expose the associated Promise | |
* instance APIs that can be used for signaling the successful | |
* or unsuccessful completion, as well as the state of the task. | |
* @export | |
* @class DeferredPromise | |
* @implements {Promise<T>} | |
* @template T | |
* @example |
View JsonSchemaToPocos.cs
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 Program | |
{ | |
private const string Cyrillic = "Cyrillic"; | |
private const string Nullable = "?"; | |
static void Main() | |
{ | |
string schemaText; | |
using (var r = new StreamReader("schema.txt")) |
NewerOlder