Skip to content

Instantly share code, notes, and snippets.

View mustakimali's full-sized avatar

Mohammad Mustakim Ali mustakimali

View GitHub Profile
@mustakimali
mustakimali / zed-keymap.json
Last active November 23, 2024 10:30
Zed keymap similar to VSCode for linux/windows
[
{
"context": "Editor",
"bindings": {
"ctrl-t": "project_symbols::Toggle",
"ctrl-shift-t": "file_finder::Toggle",
"ctrl-p": "command_palette::Toggle",
"ctrl-g ctrl-g": "editor::GoToDefinition",
"ctrl-f ctrl-f": "editor::FindAllReferences",
"ctrl-k ctrl-c": "editor::ToggleComments",
@mustakimali
mustakimali / openssl_jwe_cheatsheets.md
Last active November 21, 2023 12:20
OpenSSL/JWE Cheatsheets

Some Useful Aliases

alias openssl-genkeys="openssl genrsa -out opensslgenkeys-private-key.pem 2048 \
                && openssl rsa -in opensslgenkeys-private-key.pem -out opensslgenkeys-public-key.pem -outform PEM -pubout \
                && openssl req -key opensslgenkeys-private-key.pem -new -x509 -days 3650 -out opensslgenkeys-crt.crt \
                && openssl pkcs12 -in opensslgenkeys-crt.crt -inkey opensslgenkeys-private-key.pem -export -out opensslgenkeys-pfx.pfx \
                && openssl pkcs12 -in opensslgenkeys-crt.crt -export -out opensslgenkeys-public-key.pfx -nokeys \
                && cat opensslgenkeys-pfx.pfx | base64 -w 0 > opensslgenkeys-pfx.pfx-b64 \
                && cat opensslgenkeys-public-key.pfx | base64 -w 0 > opensslgenkeys-public-key.pfx-b64 \
                && cat opensslgenkeys-private-key.pem \
@mustakimali
mustakimali / update-dotnet-daily.sh
Last active September 1, 2021 18:21
bash file to update .net core daily build, to be used using `dn-pre`. ASSUMES: you already have ~/bin folder and included in the PATH
#!/bin/bash
set -eu
rm -rf ~/bin/dotnet-daily || true
mkdir ~/bin/dotnet-daily || true
wget -P ~/bin/dotnet-daily/ https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh
chmod +x ~/bin/dotnet-daily/dotnet-install.sh
~/bin/dotnet-daily/dotnet-install.sh -c main -v latest --install-dir ~/bin/dotnet-daily
#wget -P ~/bin/dotnet-daily/ https://aka.ms/dotnet/net6/dev/Sdk/dotnet-sdk-linux-x64.tar.gz
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");
});
});
services.AddGrpcClient<DemoService.DemoServiceClient>(c =>
{
c.BaseAddress = new Uri("http://localhost:5000");
});
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Grpc.Net.Client;
using GrpcDotNetDemoPackage;
namespace Client
{
class Program
{
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;
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Grpc.AspNetCore.Server" Version="0.1.22-pre2" />
</ItemGroup>
<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" />
syntax = "proto3";
import "google/protobuf/empty.proto";
package GrpcDotNetDemoPackage;
service DemoService {
rpc SayHello(HelloRequest) returns (HelloResponse);
rpc SayHelloToNobody(google.protobuf.Empty) returns (HelloResponse);
}