Skip to content

Instantly share code, notes, and snippets.

View junxie6's full-sized avatar
🐢
Push the limits of what's possible. Today.

Jun Hsieh junxie6

🐢
Push the limits of what's possible. Today.
View GitHub Profile
@leodido
leodido / go-syslog-octet-couting-stream.go
Last active September 6, 2020 00:11
Usage example of go-syslog to parse a stream of syslog messages with octet-counting framing
package main
import (
"io"
"time"
"github.com/davecgh/go-spew/spew"
syslog "github.com/influxdata/go-syslog/v2"
"github.com/influxdata/go-syslog/v2/octetcounting"
)
@quasilyte
quasilyte / channels.go
Created November 8, 2018 09:44
Channel vs mutex vs atomic for synchronized counter
package benchmark
import (
"context"
"runtime"
"sync"
"sync/atomic"
"testing"
"time"
)
@miguelmota
miguelmota / rsa_util.go
Last active April 21, 2024 15:10
Golang RSA encrypt and decrypt example
package ciphers
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha512"
"crypto/x509"
"encoding/pem"
"log"
)
@PCreations
PCreations / rxjs-diagrams.md
Last active January 18, 2024 08:52
Super Intuitive Interactive Diagrams to learn combining RxJS sequences by Max NgWizard K
@wwek
wwek / httpsproxy.go
Created October 29, 2017 05:41
https proxy in golang
// https://medium.com/@mlowicki/http-s-proxy-in-golang-in-less-than-100-lines-of-code-6a51c2f2c38c
// #!/usr/bin/env bash
// case `uname -s` in
// Linux*) sslConfig=/etc/ssl/openssl.cnf;;
// Darwin*) sslConfig=/System/Library/OpenSSL/openssl.cnf;;
// esac
// openssl req \
// -newkey rsa:2048 \
// -x509 \
@bojand
bojand / index.md
Last active March 1, 2024 19:32
gRPC and Load Balancing

Just documenting docs, articles, and discussion related to gRPC and load balancing.

https://github.com/grpc/grpc/blob/master/doc/load-balancing.md

Seems gRPC prefers thin client-side load balancing where a client gets a list of connected clients and a load balancing policy from a "load balancer" and then performs client-side load balancing based on the information. However, this could be useful for traditional load banaling approaches in clound deployments.

https://groups.google.com/forum/#!topic/grpc-io/8s7UHY_Q1po

gRPC "works" in AWS. That is, you can run gRPC services on EC2 nodes and have them connect to other nodes, and everything is fine. If you are using AWS for easy access to hardware then all is fine. What doesn't work is ELB (aka CLB), and ALBs. Neither of these support HTTP/2 (h2c) in a way that gRPC needs.

@xjdrew
xjdrew / client.go
Last active January 22, 2024 05:49
golang tls client and server, require and verify certificate in double direction
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io"
"io/ioutil"
"log"
"os"
@peterhellberg
peterhellberg / graceful.go
Last active August 20, 2023 08:49
*http.Server in Go 1.8 supports graceful shutdown. This is a small example.
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"time"
)
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active April 3, 2024 06:54
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@zapstar
zapstar / openssl_2way_auth.sh
Last active March 20, 2024 21:07
Steps to create CA, server and client keys + certificates for SSL 2-way authentication
# Move to root directory...
cd /
mkdir keys
cd keys
# Generate a self signed certificate for the CA along with a key.
mkdir -p ca/private
chmod 700 ca/private
# NOTE: I'm using -nodes, this means that once anybody gets
# their hands on this particular key, they can become this CA.