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
@junxie6
junxie6 / buildMySQLFromSourceCode.txt
Created September 16, 2018 16:25
Building MySQL from Source Code
# apt-get update && apt-get install build-essential cmake bison -y
# cd /usr/local/src \
&& git clone https://github.com/mysql/mysql-server.git --depth 1 \
&& mkdir bld \
&& cd bld \
&& cmake ../mysql-server \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/usr/local/src/bld \
&& make
@junxie6
junxie6 / clean-up-boot-partition-ubuntu.md
Created October 17, 2018 05:22 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

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

Reference

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

1. Check the current kernel version

$ uname -r 
@junxie6
junxie6 / graceful.go
Created November 8, 2018 04:42 — forked from peterhellberg/graceful.go
*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"
)
@junxie6
junxie6 / .gitignore
Created December 8, 2018 03:43 — forked from miku/.gitignore
Golang XML worker queue example
xmlp
@junxie6
junxie6 / call_method_with_reflection.go
Created December 10, 2018 14:20 — forked from tkrajina/call_method_with_reflection.go
Golang, call method (and fill arguments) with reflection
package main
import (
"fmt"
"reflect"
)
type Aaa struct {
a string
}
@junxie6
junxie6 / index.md
Created March 19, 2019 05:19 — forked from bojand/index.md
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.

@junxie6
junxie6 / rsa_util.go
Created July 31, 2019 05:02 — forked from miguelmota/rsa_util.go
Golang RSA encrypt and decrypt example
package ciphers
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha512"
"crypto/x509"
"encoding/pem"
"log"
)
@junxie6
junxie6 / rpc-tls-client.go
Created July 31, 2019 05:03 — forked from artyom/rpc-tls-client.go
Go RPC over TLS.You have to create the following keys: certs/client.crt, certs/client.key, certs/server.crt, certs/server.key. client.crt and server.crt should be signed with ca.crt, which should be concatenated to both client.crt and server.crt. It's easier to do with easy-rsa: http://openvpn.net/index.php/open-source/documentation/howto.html#pki
package main
import (
"crypto/tls"
"crypto/x509"
"log"
"net/rpc"
)
func main() {
@junxie6
junxie6 / DisableCertificateValidation.java
Created September 8, 2019 18:33 — forked from henrik242/DisableCertificateValidation.java
Disable validation of SSL certificates in Java
public static void disableCertificateValidation() {
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {}
public void checkServerTrusted(X509Certificate[] certs, String authType) {}
}};
@junxie6
junxie6 / Ignore certificate for HttpURLConnection in Android.java
Created September 8, 2019 18:35 — forked from aembleton/Ignore certificate for HttpURLConnection in Android.java
The following code disables SSL certificate checking for any new instances of HttpsUrlConnection
/**
* Disables the SSL certificate checking for new instances of {@link HttpsURLConnection} This has been created to
* aid testing on a local box, not for use on production.
*/
private static void disableSSLCertificateChecking() {
TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}