Skip to content

Instantly share code, notes, and snippets.

View angelobelchior's full-sized avatar
🏠
Working from home

Angelo Belchior angelobelchior

🏠
Working from home
View GitHub Profile
#Instalação
#zsh-syntax-highlighting
# > git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
#Instalação do zsh-autosuggestions
# > git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
#Instalação do zsh-fast-syntax-highlighting plugin
# > git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting
@angelobelchior
angelobelchior / permissoes_az_dev.cs
Last active January 6, 2023 14:13
Setar permissões para um usuário em um repo az dev
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
var pat = "abc123";
var organization = "my_org";
var projectName = "my_project";
var userEmail = "my@email.com";
@angelobelchior
angelobelchior / elastic stack
Last active March 21, 2021 02:34
Passo-a-passo para a instalação do Elastic Stack
#Passo-a-passo para a instalação do Elastic Stack seguindo as aulas do Eduardo Neves (https://www.youtube.com/watch?v=B3Vl0nQyK-U)
#Esse passo-a-passo foi testado no Ubuntu 20.04
#Java
sudo apt update
sudo apt install default-jre
sudo apt install default-jdk
export JAVA_HOME=/usr/lib/jvm/default-java-
export PATH=${PATH}:${JAVA_HOME}/bin
#vai no repositório de containers da MS e baixa a imagem do aspnet dando o nome de base
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
#cria uma pasta chamada app dentro da "imagem"
WORKDIR /app
#expõe a porta 80 do container (HTTP)
EXPOSE 80
#expõe a porta 443 do container (HTTPS)
public abstract class ServiceBase
{
private readonly HttpClient _httpClient;
private readonly AsyncRetryPolicy _asyncRetryPolicy;
public ServiceBase(HttpClient httpClient, RetryPolicyConfiguration retryPolicyConfiguration)
{
this._httpClient = httpClient;
this._asyncRetryPolicy = this.CreatePolicy(retryPolicyConfiguration);
}
protected async Task<Result<T>> Get<T>(string url)
{
return await this._asyncRetryPolicy.ExecuteAsync(async () =>
{
var response = await this._httpClient.GetAsync(url);
return await this.GetRequestContent<T>(response);
});
}
private AsyncRetryPolicy CreatePolicy(RetryPolicyConfiguration retryPolicyConfiguration)
=> Policy.Handle<Exception>(e => true)
.WaitAndRetryAsync(retryCount: retryPolicyConfiguration.RetryCount,
retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryPolicyConfiguration.RetryAttemptFactor))
);
// Adiciona-se o namespace
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
// E no método OnAppearing...
protected override void OnAppearing()
{
base.OnAppearing();
this.On<iOS>().SetUseSafeArea(true);
this.On<iOS>().SetPrefersLargeTitles(true);
}
<?xml version="1.0" encoding="utf-8"?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
android:TabbedPage.ToolbarPlacement="Bottom"
// Adiciona-se o namespace
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
// E no método OnAppearing...
protected override void OnAppearing()
{
base.OnAppearing();
this.On<Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
}