Skip to content

Instantly share code, notes, and snippets.

⚡️
Loading, please wait...

Mustakim Ali mustakimali

⚡️
Loading, please wait...
Block or report user

Report or block mustakimali

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Kestrel-https2-grpc.cs
c.Listen(IPEndPoint.Parse("0.0.0.0:5000", l =>
{
l.Protocols = HttpProtocols.Http2;
l.UseHttps(config =>
{
config.ServerCertificate = new X509Certificate2(Convert.FromBase64String("PFX-BASE64", "PASSWORD");
});
});
View AddGrpcClient-example.cs
services.AddGrpcClient<DemoService.DemoServiceClient>(c =>
{
c.BaseAddress = new Uri("http://localhost:5000");
});
View Client.cs
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Grpc.Net.Client;
using GrpcDotNetDemoPackage;
namespace Client
{
class Program
{
View Server.cs
using System.Net;
using System.Threading.Tasks;
using Google.Protobuf.WellKnownTypes;
using Grpc.Core;
using GrpcDotNetDemoPackage;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
View Server.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Grpc.AspNetCore.Server" Version="0.1.22-pre2" />
</ItemGroup>
View Protos.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Grpc.Core" Version="1.22.0" />
<PackageReference Include="Grpc.Tools" Version="1.22.0-pre1" />
<PackageReference Include="Google.Protobuf" Version="3.9.0-rc1" />
View DemoService.proto
syntax = "proto3";
import "google/protobuf/empty.proto";
package GrpcDotNetDemoPackage;
service DemoService {
rpc SayHello(HelloRequest) returns (HelloResponse);
rpc SayHelloToNobody(google.protobuf.Empty) returns (HelloResponse);
}
@mustakimali
mustakimali / goaccess-kubernetes-nginx-ingress.py
Last active Aug 14, 2019
Gets logs from nginx-ingress container and generate GoAccess dashboard for each of the services + all combined (Blog: https://mustak.im/server-side-kubernetes-nginx-ingress-log-analysis-using-goaccess/)
View goaccess-kubernetes-nginx-ingress.py
#!/usr/bin/python
import os
import subprocess
def process_log_for_svc(svc,out):
print('Processing ' + svc)
os.system("rm -f /storage/goaccess/imported-logs/imported-log.log")
os.system('find /var/log/containers/ | grep nginx-ingress | xargs sudo cat | grep ' + svc + ' >> /storage/goaccess/imported-logs/imported-log.log')
View oc_dotnet.sh
#!/bin/sh
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget -q https://packages.microsoft.com/config/debian/9/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get -y install apt-transport-https
sudo apt-get update
View ocs.sh
!#bin/bash
sudo apt update
sudo apt install -y curl git
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
source ~/.zshrc
You can’t perform that action at this time.