Skip to content

Instantly share code, notes, and snippets.

View duythinht's full-sized avatar
💭
I may be slow to respond.

Thinh Tran duythinht

💭
I may be slow to respond.
View GitHub Profile
@duythinht
duythinht / gRPC.md
Last active May 28, 2020 12:01
gRPC

Why gRPC

gRPC is a modern open source high performance RPC framework that can run in any environment. It can efficiently connect services in and across data centers with pluggable support for load balancing, tracing, health checking and authentication. It is also applicable in last mile of distributed computing to connect devices, mobile applications and browsers to backend services.

  • Simple service definition - Define your service using Protocol Buffers, a powerful binary serialization toolset and language
  • Works across languages and platforms - Automatically generate idiomatic client and server stubs for your service in a variety of languages and platforms
  • Start quickly and scale * Install runtime and dev environments with a single line and also scale to millions of RPCs per second with the framework
  • Bi-directional streaming and integrated auth - Bi-directional streaming and fully integrated pluggable authentication with HTTP/2-based transport

Ref: https://grpc.io/about/

# Configuration for Alacritty, the GPU enhanced terminal emulator
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty it self.
env:
# TERM env customization.
#
# If this property is not set, alacritty will set it to xterm-256color.
@duythinht
duythinht / README.MD
Last active June 10, 2019 16:36
That was a thing, which I want.
  • Must have Dockerfile inside project, that able to run docker built -t test:1.0.0 ./
  • Image must be expose port as 80
  • Image after build could run directly without any config file, config only accept to inject by environment variables
docker run -e "MYSQL_HOST=127.0.0.1" -e "MYSQL_USERNAME=root" test:1.0.0
  • Must have Jenkins file follow this pattern
pipeline {
    agent any
@duythinht
duythinht / buffers.Image.go
Last active March 29, 2018 14:32
Flatbuffers for mirage
// automatically generated by the FlatBuffers compiler, do not modify
package buffers
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type Image struct {
_tab flatbuffers.Table
with open("values.txt") as f:
key_pairs = (line.split("=") for line in f.readlines())
values = {item[0]: item[1] for item in key_pairs}
@duythinht
duythinht / main.go
Created December 2, 2016 08:54
println! still done!
package main
import (
"fmt"
"os"
"time"
)
func println(id int, done chan bool, messages <-chan string, result chan int) {
for message := range messages {
@duythinht
duythinht / test.js
Created November 23, 2016 04:37
AlertXSS
alert('hello world');
@duythinht
duythinht / concept.go
Created November 22, 2016 05:08
Try, error handling with Go.
func func1(returnError bool) (&bool, error);
result, error := Do(func(try) {
result0 := try.F1(func1(false))
result1 := try.F1(func1(!result0))
result2 := try.F1(func1(result1))
})
@duythinht
duythinht / app.py
Created November 11, 2016 07:08
What is jsonp?
from bottle import *
import json
@get('/users/:id')
def get(id):
# Check if request has callback query, return jsonp
if request.query.callback:
return request.query.callback + "(%s);" % json.dumps(user_by_id(id))
# else return json p
return user_by_id(id)
@duythinht
duythinht / index.js
Created September 7, 2016 08:32
Restart on demand
const cluster = require('cluster')
var logger = require('log4js').getLogger()
var locator = require('consul-locator')
locator.use({host: '10.60.3.231'})
logger.info('Start workers')
function startWorker(name) {