segunda-feira, 4 de dezembro de 2023

How to remove unpushed commit in Visual Studio

 git reset --soft HEAD~


https://stackoverflow.com/a/63343196/194717

I did this to solve a conflict when doing a pull request

I did this to solve a conflict when doing a pull request


git pull

git checkout <feature_branch>

git pull origin <destination_branch>


At this point, pulling the destination will try to merge it with the source and reveal all the conflicts.


computer:my-repository emmap$ git pull origin main

 * branch            main     -> FETCH_HEAD

Auto-merging team_contact_info.txt

CONFLICT (content): Merge conflict in team_contact_info.txt

Automatic merge failed; fix conflicts and then commit the result.


Open the file to resolve the conflict. You can do this using the command line or you can navigate to the file.


git add <filename>

git commit -m'commit message'

git push origin <feature_branch>


https://support.atlassian.com/bitbucket-cloud/docs/resolve-merge-conflicts/


sábado, 4 de novembro de 2023

sábado, 14 de outubro de 2023

How to see the connected/known WiFi password on Windows

netsh wlan show profile WIFISSID key=clear


replace WIFISSID  with your actual WiFi SSID

sábado, 2 de setembro de 2023

My Smart plug ports

TCP/UDP ports

6600 to 6699

and 

8883

terça-feira, 4 de julho de 2023

ASP.NET Response Compression

 

//public void ConfigureServices(IServiceCollection services)

services.AddResponseCompression(options =>

{

    options.MimeTypes = new[] { "application/json" };

    //options.EnableForHttps = true;

});

// ...

// public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceScopeFactory scopeFactory)

app.UseResponseCompression();


Beware of the security issues when using EnableForHttps .

ASP.NET 8 Rate Limit - AddTokenBucketLimiter

 

builder.Services.AddRateLimiter(o =>

{

    o.AddTokenBucketLimiter("token", y =>

    {

        y.TokenLimit = 100;

        y.QueueProcessingOrder = System.Threading.RateLimiting.QueueProcessingOrder.OldestFirst;

        y.QueueLimit = 5;

        y.ReplenishmentPeriod = TimeSpan.FromSeconds(10);

        y.TokensPerPeriod = 20;

        y.AutoReplenishment = true;

    });

});


Source: https://twitter.com/mjovanovictech/status/1676185657092317187

How to get QueryString in .NET 8 Blazor using [SupplyParameterFromQuery]

To read a query string value, there is the  [Parameter] [SupplyParameterFromQuery]


@page "/"

<span>MyValue: @MyValue</span>

@code 

{

    [Parameter]

    [SupplyParameterFromQuery]

    public string MyValue { get; set; }

}


Source: Weston Walker on Twitter: "TIL in .NET Blazor you can get query strings from the URL and set them to a variable with the [SupplyParameterFromQuery] attribute. I'm finding it super handy for Oauth callback scenarios where you get a code back in the url from a external service. https://t.co/ERvhlQOlC1" / Twitter

segunda-feira, 15 de maio de 2023

WiFi 6 - 802.11ax

WiFi 6 - 802.11ax
WiFi 5 - 802.11ac
WiFi 4 - 802.11n



domingo, 14 de maio de 2023

Authentication in Blazor Server

Authentication in Blazor Server



You're using AuthenticationStateProvider wrong in your Blazor Server app! Let's fix it!



terça-feira, 18 de abril de 2023

How to parse Multipart Form File

 To parse multipart form using .NET 7, you can use the MultipartFormDataParser class from the Http-Multipart-Data-Parser package1. You can parse the stream containing the multipart/form-data by invoking MultipartFormDataParser.Parse (or it’s asynchronous counterpart MultipartFormDataParser.ParseAsync). Access the data through the parser1.

Here’s an example of how you can parse a multipart/form-data request in .NET 7 using Http-Multipart-Data-Parser package1:

using HttpMultipartParser;
using System.IO;

// ...

var parser = new MultipartFormDataParser(Request.Body);
foreach (var file in parser.Files)
{
    var filename = file.FileName;
    var contentType = file.ContentType;
    var content = file.Data;
    // Do something with the file
}

I hope this helps! Let me know if you have any other questions.

segunda-feira, 3 de abril de 2023

Azure Event Grid Storage Account PutBlob DeleteBlob Events


{"api":"PutBlob","clientRequestId":"11274a18-88ad-4038-8411-0f8c12e06016","requestId":"f336c9c2-301e-0054-113a-6636d4000000","eTag":"0x8DB345182F07EBA","contentType":"video/mp4","contentLength":18026572,"blobType":"BlockBlob","url":"https://[storageaccount].blob.core.windows.net/teste/dub_portugues.mp4","sequencer":"0000000000000000000000000000663400000000013c15cb","storageDiagnostics":{"batchId":"96d72e50-6006-0014-003a-6631ec000000"}}

{"api":"DeleteBlob","clientRequestId":"5f63b2d5-e9ed-4dca-9a02-484424c9b6d6","requestId":"12e55510-e01e-0057-4e3a-66d7b0000000","eTag":"0x8DB34516DF03AB1","contentType":"video/mp4","contentLength":18035781,"blobType":"BlockBlob","url":"https://[storageaccount].blob.core.windows.net/teste/dub_espanol.mp4","sequencer":"0000000000000000000000000000663400000000013c143d","storageDiagnostics":{"batchId":"96d682ca-6006-0014-003a-6631ec000000"}}


Related:

How to receive Azure Storage Account Network Share File and Directory events on Azure Event Grid Subscription?

https://stackoverflow.com/q/75921159/194717


sexta-feira, 17 de fevereiro de 2023

Azure DevOps - npm cache

This is my setup:
steps:
- task: Cache@2
  displayName: 'Cache npm'
  inputs:
    key: '"YourAppName" | "$(Build.SourceBranchName)" | "Android" | "npm" | "$(Agent.OS)" | "$(myDate)" | $(Build.SourcesDirectory)/package.json'
    path: '$(Build.SourcesDirectory)/node_modules'
    cacheHitVar: 'CACHE_RESTORED'