Skip to content

Instantly share code, notes, and snippets.

View eaba's full-sized avatar

Ebere Abanonu eaba

View GitHub Profile
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RootNamespace></RootNamespace>
<IsPackable>False</IsPackable>
<NoWarn>CS0649;CS0169</NoWarn>
@eaba
eaba / kubernetes-gencerts.sh
Created August 22, 2020 15:05 — forked from fauberso/kubernetes-gencerts.sh
Generates self-signed tls secrets for kubernetes. Run this with e.g. 'kubernetes-gencerts microk8s.local', then install the secrets with 'kubectl apply -f microk8s.local.yaml'
#!/bin/bash
HOSTNAME=${1:-localhost}
openssl req -newkey rsa:2048 -nodes -keyout $HOSTNAME.key -x509 -days 3650 -out $HOSTNAME.crt
echo "apiVersion: v1
kind: Secret
metadata:
name: $HOSTNAME.tls
namespace: default
type: kubernetes.io/tls
data:
@eaba
eaba / hls.conf
Created July 13, 2020 09:21 — forked from jb-alvarado/hls.conf
srs rtmp server with hls multiple bitrates
listen 1935;
max_connections 20;
daemon on;
pid /usr/local/srs/objs/srs.pid;
srs_log_tank file; # console;
srs_log_file /var/log/srs.log;
ff_log_dir /dev/null;
# can be: verbose, info, trace, warn, error
srs_log_level warn;

This doc demonstrates how to do geo-replication across multiple pulsar clusters without a global configuration store (zookeeper).

This demo is using docker-compose to start 3 pulsar clusters. Each pulsar cluster has 1 zk, 1 bk, and 1 broker. The docker compose file can be found at https://gist.github.com/sijie/63737459112471a82957ae20bd78adb5.

The information of all the three clusters is listed in the following table:

zk configuration store broker
beijing zk-beijing zk-beijing broker-beijing
// Here you can find full description: https://thetial.com/rsa-encryption-and-decryption-net-core/
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Encodings;
using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.OpenSsl;
@eaba
eaba / gist:e52fea4304d3c9ce5a0942e5cc1cf4e0
Created March 11, 2020 07:19
BouncyCastle RSA keys to bytes and back
RsaKeyPairGenerator r = new RsaKeyPairGenerator();
r.Init(new KeyGenerationParameters(prng, 2048));
AsymmetricCipherKeyPair keys = r.GenerateKeyPair();
SubjectPublicKeyInfo pubF = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(keys.Public);
byte[] pubbytes = pubF.GetDerEncoded();
PrivateKeyInfo privF = PrivateKeyInfoFactory.CreatePrivateKeyInfo(keys.Private);
byte[] privBytes = privF.GetDerEncoded();
// encrypt with public
SubjectPublicKeyInfo pbInfo = SubjectPublicKeyInfo.GetInstance(pubbytes);
@eaba
eaba / gist:3adff44483fe8630f4c527abb7903c3e
Created January 4, 2020 18:47 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
Can this be taken for Session Id?: AuthenticationTicket.Properties.Dictionary[".sessionState"]