Skip to content

Instantly share code, notes, and snippets.

using System.IdentityModel.Tokens.Jwt;
using Microsoft.AspNetCore.Authentication;
using Microsoft.IdentityModel.Protocols;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
using Microsoft.IdentityModel.Tokens;
namespace ReverseProxy.Common;
//https://blog.cellenza.com/en/cloud/secure-access-to-swagger-ui-with-azure-active-directory/
//https://medium.com/@niteshsinghal85/securing-swagger-ui-in-production-in-asp-net-core-part-2-dc2ae0f03c73
@danielcrenna
danielcrenna / EndpointTests.cs
Created March 5, 2021 18:18
ASP.NET Core: Show web application logs in in-memory integration tests
// Copyright (c) Daniel Crenna. All rights reserved.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at http://mozilla.org/MPL/2.0/.
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Testing;
using Xunit;

Este arquivo ainda está em construção, mas espero que já possa ser de ajuda.

Introdução

Neste documento você irei falar sobre algumas coisas que eu sei e utilizo para configurar as lives. Não sou expert, nem nada, comecei a fazer oficialmente live em Outubro/Novembro em 2020, mas das coisas que sei já chegaram a ajudar algumas pessoas próximas a mim e a deixar suas lives da forma que agradavam a elas. Então, espero que possa ajudar você também.

Nota: Tudo aqui pode ser alterado de acordo com sua necessidade. Eu não estou ditando regras, nem falando uma verdade absoluta. É puramente minha singela esperiência de como uso o OBS.

Aqui você verá

@otonii
otonii / oh-my-posh.md
Last active November 1, 2023 14:31
oh-my-posh

oh-my-posh

Deprecated: Use https://github.com/otonii/meu-terminal, esse carinha aqui não será mais atualizado.

Terminal Image

Obter a versão mais recente da Galeria do PowerShell

Antes de atualizar o PowerShellGet, você sempre deve instalar o provedor do NuGet mais recente. Em uma sessão do PowerShell com privilégios elevados, execute os comandos a seguir.

@willianfalbo
willianfalbo / README.md
Last active April 18, 2024 13:22
Expanding disk inside Hyper-V using Linux Virtual Machine (Ubuntu)

Expanding disk inside Hyper-V using Linux Virtual Machine (Ubuntu)

  1. Turn off your virtual machine

  2. Go to Settings > SCSI Controller > Hard Drive. In the Media section, edit the Virtual Hard Disk and expand to desired space

  3. Start the virtual machine and connect to it

  4. Install the GParted by running the command sudo apt install gparted

@sandcastle
sandcastle / Dockerfile
Created October 21, 2019 12:18
Install .Net 3.0 diagnostic tools in a docker container
# https://github.com/dotnet/diagnostics/issues/573#issuecomment-543886037
# dotnet tools are currently available as part of SDK so we need to create them in an sdk image
# and copy them to our final runtime image
FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS tools-install
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-sos
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-trace
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-dump
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-counters
@hashtagchris
hashtagchris / azureDevOpsPRCommentSearch.js
Last active April 4, 2024 20:12
Quick and dirty script to search comment threads in Azure DevOps pull requests.
// Script pre-reqs
// 1. Install nodejs and npm
// 2. Run `npm install`
// 3. Set the AZURE_DEVOPS_PAT environment variable, or create a .env file and assign a value (AZURE_DEVOPS_PAT=...)
// TODO: Retrieve multiple pages of PRs, threads.
require("dotenv").config();
const request = require('request-promise-native');
@ndc
ndc / HFDashboardAuthFilter.cs
Created September 1, 2018 12:30
Hangfire dashboard authorization filter using basic authentication and relying on browser support to allow user to input username and password.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Hangfire.Annotations;
using Hangfire.Dashboard;
using Microsoft.AspNetCore.Http;
namespace MyApp.ScheduledTask
{

The PATH is an important concept when working on the command line. It's a list of directories that tell your operating system where to look for programs, so that you can just write script instead of /home/me/bin/script or C:\Users\Me\bin\script. But different operating systems have different ways to add a new directory to it:

Windows

  1. The first step depends which version of Windows you're using:
  • If you're using Windows 8 or 10, press the Windows key, then search for and
@adjames
adjames / GenericConstructorHelper.cs
Created February 4, 2012 07:29
Workaround for inability to create C# generic constraints for the presence of a constructor that takes parameters... i.e. Foo<T>(string name) where T: new(string)
public Func<T1, TResult> CompileConstructor<T1, TResult>()
{
var type1 = typeof(T1);
var parameter1 = Expression.Parameter(type1);
var constructor = typeof(TResult).GetConstructor(new Type[] { type1 });
var body = Expression.New(constructor, parameter1);
var lambda = Expression.Lambda<Func<T1, TResult>>(body, parameter1);
var method = lambda.Compile();
return method;
}