Skip to content

Instantly share code, notes, and snippets.

View vanderlei-dev's full-sized avatar

Vanderlei Morais vanderlei-dev

View GitHub Profile
@vanderlei-dev
vanderlei-dev / deletevscodecreds.ps1
Created June 12, 2024 21:14 — forked from codekoenig/deletevscodecreds.ps1
Delete all VSCode credentials in Windows Credentials Manager
<#
VSCode has a bug where it fills up the Windows Credentials Manager with credentials up to the point where no new credentials can be added.
This leads to multiple issues, one of them for example that VSCode itself cannot store any more credentials there.
You'll notice this when you have to sign in to your Microsoft or Github account in VSCode after each restart.
#>
# List all VSCode entries in Windows Credential Manager
cmdkey /list | ForEach-Object{if($_ -like "*Target:*" -and $_ -like "*vscodevscode.microsoft-*"){echo $_.substring(30)}}
# Delete all VSCode credential entries in Windows Credential Manager
using System.Text.Json.Serialization;
using RestSharp.Authenticators;
namespace RestSharp.Tests.External.Twitter;
public interface ITwitterClient
{
Task<TwitterUser> GetUser(string user);
}
public ReadOnlySpan<char> FormatarCpf(string cpf)
{
Span<char> formattedValue = stackalloc char[14];
Copy(cpf, startIndex: 0, length: 3, ref formattedValue, insertIndex: 0);
formattedValue[3] = '.';
Copy(cpf, startIndex: 3, length: 3, ref formattedValue, insertIndex: 4);
formattedValue[7] = '.';
public string FormatarCpf(string cpf)
{
return Convert.ToUInt64(cpf).ToString(@"000\.000\.000\-00");
}
public string FormatarCpf(string cpf)
{
// cpf: 12345678909
return $"{cpf.Substring(0, 3)}." + // 123.
$"{cpf.Substring(3, 3)}." + // 456.
$"{cpf.Substring(6, 3)}-" + // 789-
$"{cpf.Substring(9, 2)}"; // 09
// resultado: 123.456.789-09