Skip to content

Instantly share code, notes, and snippets.

View manishtiwari25's full-sized avatar
:octocat:
Focusing

Manish Tiwari manishtiwari25

:octocat:
Focusing
View GitHub Profile
JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions()
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};
CosmosSystemTextJsonSerializer cosmosSystemTextJsonSerializer = new CosmosSystemTextJsonSerializer(jsonSerializerOptions);
CosmosClientOptions cosmosClientOptions = new CosmosClientOptions()
{
ApplicationName = "Test",
Serializer = cosmosSystemTextJsonSerializer
};
public class CosmosSystemTextJsonSerializer : CosmosSerializer
{
private readonly JsonObjectSerializer systemTextJsonSerializer;
public CosmosSystemTextJsonSerializer(JsonSerializerOptions jsonSerializerOptions)
{
this.systemTextJsonSerializer = new JsonObjectSerializer(jsonSerializerOptions);
}
public override T FromStream<T>(Stream stream)
@manishtiwari25
manishtiwari25 / Deploy.ps1
Last active August 9, 2023 17:35
Scripts to automate azure b2c custom policy deployment and validation, for more info (https://blogs.bitesinbyte.com/blogPost/a474c427-52d8-4f7d-9f65-02822fced323)
param(
[Parameter(Mandatory = $true)]
[string]$clientID,
[Parameter(Mandatory = $true)]
[string]$clientSecret,
[Parameter(Mandatory = $true)]
[string]$tenantId,
param(
[string]$storageAccount,
[string]$blobContainer,
[string]$instanceName,
[string]$databaseName,
[string]$storageKey
)
import-module sqlps;
$sqlPath = "sqlserver:\sql\$($env:COMPUTERNAME)"
@manishtiwari25
manishtiwari25 / wellKnow.proto
Created March 21, 2022 17:15
gRPC well know type example
syntax = "proto3"
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto"
message Meeting {
google.protobuf.StringValue subject = 1;
google.protobuf.Timestamp time = 2;
google.protobuf.Duration duration = 3;
@manishtiwari25
manishtiwari25 / scalarTypes.proto
Created March 21, 2022 17:09
scalar value types gRPC
syntax = "proto3"
message Something {
string subject = 1;
int32 id = 2;
float floatVar = 3;
}
@manishtiwari25
manishtiwari25 / world_currency_symbols.json
Last active April 22, 2024 14:09
List Of World Currency with symbols, Updated On 04/01/2024 00:00:02
[
{
"Flag": "https://www.currencyremitapp.com/wp-content/themes/currencyremitapp/images/countryimages/albania.png",
"CountryName": "Albania",
"Currency": "Lek",
"Code": "ALL",
"Symbol": "Lek"
},
{
"Flag": "https://www.currencyremitapp.com/wp-content/themes/currencyremitapp/images/countryimages/afghanistan.png",
@manishtiwari25
manishtiwari25 / country_state.json
Last active April 12, 2024 21:59
List Of Countries With States And Other Useful Information, Updated On 04/01/2024 00:00:02
[
{
"name": "Andorra",
"countryCode": "AD",
"countryCodeAlpha3": "AND",
"phone": "376",
"currency": "EUR",
"stateProvinces": [
{
"name": "Sant Julià de Loria"
@manishtiwari25
manishtiwari25 / SendMail.cs
Last active February 19, 2021 15:13
Send mail using O365 account c#
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using RestSharp;
public class Body
{
[JsonPropertyName("contentType")]
public string ContentType { get; set; }
[JsonPropertyName("content")]
@manishtiwari25
manishtiwari25 / jwt_validation.xml
Created May 11, 2020 02:31
Azure API Management, JWT Validation, Inbound process
<policies>
<inbound>
<base />
<validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized. Access token is missing or invalid." require-scheme="Bearer" output-token-variable-name="jwt">
<openid-config url="B2c Run URL" />
<audiences>
<audience>{Application ID}</audience>
</audiences>
<issuers>
<issuer>{Issuer}</issuer>