Skip to content

Instantly share code, notes, and snippets.

View kolosovpetro's full-sized avatar

Petro Kolosov kolosovpetro

View GitHub Profile
@kolosovpetro
kolosovpetro / .gitattributes
Last active March 26, 2023 11:43
.gitattributes
* text=auto eol=lf
*.html linguist-detectable=false
*.cshtml linguist-detectable=false
*.htm linguist-detectable=false
*.razor linguist-detectable=false
@kolosovpetro
kolosovpetro / .gitignore
Last active December 17, 2022 20:31
.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# terraform
*.lock.hcl
*.tfplan
@kolosovpetro
kolosovpetro / Azure_AD_Role_Based_Authentication.md
Last active September 17, 2022 14:18
Quick and simple role-based Azure Active Directory authentication and authorization using JWT tokens

Quick And Simple API Auth

Quick and simple role-based Azure Active Directory authentication and authorization using JWT tokens

1. Create app registration

  • Navigate to Azure portal and create app registration: QuickAndSimpleApiAuthApp with Single tenant
  • Record the data of newly QuickAndSimpleApiAuthApp created app registration:
    • Client ID: 6f33c1bb-4290-40ed-a026-8fb4bb8b326e
  • Tenant ID: b40a105f-0643-4922-8e60-10fc1abf9c4b
@kolosovpetro
kolosovpetro / Azure_commands.md
Last active August 20, 2023 14:31
Azure commands

Az account management commands

Login

  • az login
  • az login --use-device-code

Subscription

  • az account subscription list
  • az account set --subscription "name or id"
  • az account list -o table
using System.Net.Http;
using Extreme.Bot;
using Extreme.Bot.Services;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Telegram.Bot;
var builder = WebApplication.CreateBuilder(args);
var botConfiguration = ConfigurationService.CreateConfiguration();
[Unit]
Description=Mango Messenger Backend Service for Azure Dev Environment
After=network.target
[Service]
Environment=ASPNETCORE_URLS=http://+:8080/
Environment=MANGO_JW_ISSUER="https://front.mangomessenger.company"
Environment=MANGO_JWT_AUDIENCE="https://back.mangomessenger.company"
Environment=MANGO_JWT_SIGN_KEY="d32d7cea-4cb8-4488-aa94-323ffb8cbdf4"
Environment=MANGO_EMAIL_NOTIFICATIONS_ADDRESS="[email protected]"
server {
server_name STATIC_IP_ADDRESS_OF_VM;
location / {
include proxy_params;
proxy_pass http://127.0.0.1:8080;
}
location /swagger {
include proxy_params;
// See https://aka.ms/new-console-template for more information
using System.Runtime.InteropServices;
const string s = "hello world.";
Span<char> span = MemoryMarshal.CreateSpan(ref MemoryMarshal.GetReference(s.AsSpan()), s.Length);
span[11] = '!';
Console.WriteLine(s);
using System.ComponentModel;
namespace DCC.WTMP.Modules.Configuration.Domain.Company;
/// <summary>
/// ISO-3166 Alpha-2 country codes.
/// https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
/// </summary>
public enum CountryEnum
{