Skip to content

Instantly share code, notes, and snippets.

View alexandrebl's full-sized avatar
🛰️
Working from space

ABrandaoL alexandrebl

🛰️
Working from space
View GitHub Profile
@alexandrebl
alexandrebl / ClienteUsingDependencyInjectionNamedHttpClientFactory.cs
Created April 22, 2022 14:31
Cliente Using Dependency Injection Named Http Client Factory
public class NamedClientModel : PageModel
{
private readonly IHttpClientFactory _httpClientFactory;
public NamedClientModel(IHttpClientFactory httpClientFactory) =>
_httpClientFactory = httpClientFactory;
public IEnumerable<GitHubBranch>? GitHubBranches { get; set; }
public async Task OnGet()
@alexandrebl
alexandrebl / DINamedHttpClientFactory.cs
Created April 22, 2022 14:30
Dependency Injection Named Http Client Factory
builder.Services.AddHttpClient("GitHub", httpClient =>
{
httpClient.BaseAddress = new Uri("https://api.github.com/");
// using Microsoft.Net.Http.Headers;
// The GitHub API requires two headers.
httpClient.DefaultRequestHeaders.Add(
HeaderNames.Accept, "application/vnd.github.v3+json");
httpClient.DefaultRequestHeaders.Add(
HeaderNames.UserAgent, "HttpRequestsSample");
@alexandrebl
alexandrebl / InstallDockeronUnbuntuWSL.md
Created April 22, 2022 14:07
Install Docker on Unbuntu WSL

Parte 1: instalar Ubuntu LTS

Parte 2: instalar o docker

$sudo apt update $sudo apt install apt-transport-https ca-certificates curl software-properties-common $sudo apt install build-essential $curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add $sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" $sudo apt update $sudo apt install docker-ce

@alexandrebl
alexandrebl / LedBlinkPIC24FJ128GA204.c
Created February 25, 2022 17:56
LedBlinkPIC24FJ128GA204
#include <xc.h>
#include <stdbool.h>
#define FCY 4000000UL
#include <libpic30.h>
#define LED_LD3_RED_LAT LATCbits.LATC5
#define LED_LD3_GREEN_LAT LATCbits.LATC6
#define LED_LD3_BLUE_LAT LATCbits.LATC7
#define LED_LD1_LAT LATAbits.LATA9
#define LED_LD2_LAT LATAbits.LATA10
@alexandrebl
alexandrebl / NATS.io.RequestReply.sub.cs
Created February 8, 2022 13:29
NATS.io.RequestReply.sub.cs
using NATS.Client;
using System;
using System.Text;
using System.Text.Json;
using System.Threading;
namespace NatsSub1
{
internal class Program
{
@alexandrebl
alexandrebl / NATS.io.RequestReply.pub.cs
Created February 8, 2022 13:29
NATS.io.RequestReply.pub.cs
using NATS.Client;
using System;
using System.Text;
using System.Text.Json;
using System.Threading;
namespace NatsPub1
{
internal class Program
{
@alexandrebl
alexandrebl / NATS.Queue.Group.Subscriber.cs
Created February 5, 2022 20:13
NATS.Queue.Group.Subscriber.cs
using NATS.Client;
using System;
using System.Threading;
namespace NatsSub1
{
internal class Program
{
static void Main(string[] args)
{
@alexandrebl
alexandrebl / NATS.Queue.Group.Publisher.cs
Last active February 5, 2022 20:13
NATS.Queue.Group.Publisher.cs
using NATS.Client;
using System;
using System.Text;
using System.Threading;
namespace NatsPub1
{
internal class Program
{
static void Main(string[] args)
@alexandrebl
alexandrebl / NATS.io.RX.Observer.Header.Filters.Subscriber.cs
Last active February 5, 2022 17:56
NATS.io.RX.Observer.Header.Filters.Subscriber.cs
using NATS.Client;
using NATS.Client.Rx;
using NATS.Client.Rx.Ops;
using System;
using System.Text;
namespace NatsSub1
{
internal class Program
{
@alexandrebl
alexandrebl / NATS.io.RX.Observer.Header.Filters.Publisher.cs
Last active February 5, 2022 17:56
NATS.io.RX.Observer.Header.Filters.Publisher.cs
using NATS.Client;
using System;
using System.Text;
using System.Threading;
namespace NatsPub1
{
internal class Program
{
static void Main(string[] args)