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 / go-syslog-octet-couting-stream.go
Created September 6, 2020 00:11 — forked from leodido/go-syslog-octet-couting-stream.go
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"
)
@junxie6
junxie6 / http_streaming.md
Created August 22, 2020 06:12 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@junxie6
junxie6 / rxjs-diagrams.md
Created April 10, 2020 02:13 — forked from PCreations/rxjs-diagrams.md
Super Intuitive Interactive Diagrams to learn combining RxJS sequences by Max NgWizard K
@junxie6
junxie6 / introrx.md
Created March 22, 2020 17:56 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@junxie6
junxie6 / bobp-python.md
Created February 6, 2020 05:43 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@junxie6
junxie6 / announce.php
Created January 20, 2020 04:25 — forked from nsuan/announce.php
Bitstorm Tracker
<?php
/*
* Bitstorm - A small and fast Bittorrent tracker
* Copyright 2008 Peter Caprioli
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@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;
}
@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 / 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 / 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"
)