Skip to content

Instantly share code, notes, and snippets.

View liubin's full-sized avatar

Bin Liu liubin

View GitHub Profile
@liubin
liubin / golang_job_queue.md
Created August 11, 2017 10:06 — forked from harlow/golang_job_queue.md
Job queues in Golang
@liubin
liubin / out_forward.conf
Created September 30, 2017 06:52 — forked from sonots/out_forward.conf
ログの欠損をできるだけ避ける Fluentd の out_forward 設定サンプル cf. http://blog.livedoor.jp/sonots/archives/44690980.html
<source>
type in_tail
# ...
tag raw.eventlog
</source>
<match raw.**>
type forward
log_level "#{ENV['DEBUG'] ? 'debug' : 'info'}"
@liubin
liubin / ssh-d4m
Created November 6, 2017 11:40
SSH into Docker for Mac xhyve VM
1. screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
2. when done use CTRL-A CTRL-\ and then y (for yes) to exit
Alternative method:
1. docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh
@liubin
liubin / kubecon_curl.sh
Created December 11, 2017 04:52 — forked from superbrothers/kubecon_curl.sh
Download Kubecon Austin 2017 presentations from Sched
#!/bin/bash
mkdir -p kubecon_files
DAYS=("2017-12-06" "2017-12-07" "2017-12-08")
for DAY in "${DAYS[@]}"; do
#Super shitty pipefest because of grep matched groups sadness
LINKS=($(curl https://kccncna17.sched.com/${DAY}/overview | grep -oEi "f='(.*)' cl" | cut -d\' -f 2 | tr '\n' ' '))
for LINK in "${LINKS[@]}"; do
echo "Requesting https://kccncna17.sched.com/${LINK}"
@liubin
liubin / gist:7db1f942753f40e510674c0b997e950f
Last active January 15, 2021 16:51 — forked from jordelver/gist:3073101
Set the Mac OS X SOCKS proxy on the command line

Set the Mac OS X SOCKS proxy on the command line

a.k.a. what to do when your ISP starts blocking sites :(

Get devices list

networksetup -listnetworkserviceorder

Set the SOCKS proxy to local SSH tunnel

@liubin
liubin / squash-commits.md
Last active January 19, 2018 08:11 — forked from jbub/squash-commits.sh
git squash last two commits into one

1

git rebase --interactive HEAD~2

#  we are going to squash c into b 
pick b76d157 b
pick a931ac7 c

# squash c into b

When Istio Meets Jaeger - An Example of End-to-end Distributed Tracing

Kubernetes is great! It helps many engineering teams to realize the dream of SOA (Service Oriented Architecture). For the longest time, we build our applications around the concept of monolith mindset, which is essentially having a large computational instance running all services provided in an application. Things like account management, billing, report generation are all running from a shared resource. This worked pretty well until SOA came along and promised us a much brighter future. By breaking down applications to smaller components, and having them to talk to each other using REST or gRPC. We hope expect things will only get better from there but only to realize a new set of challenges awaits. How about cross services communication? How about observability between microservices such as logging or tracing? This post demonstrates how to set up OpenTracing inside a Kubernetes cluster that enables end-to-end tracing between serv

@liubin
liubin / main.go
Created April 18, 2018 08:47 — forked from hnakamur/main.go
A go example to stop a worker goroutine when Ctrl-C is pressed (MIT License)
package main
import (
"fmt"
"os"
"os/signal"
"time"
"golang.org/x/net/context"
)
@liubin
liubin / k8s-csr-approve.sh
Last active July 19, 2018 03:49 — forked from aojea/k8s-csr-approve.sh
online kubernetes certificate auto approval
for i in $(kubectl get csr | grep Pending | awk '{ print $1 }' ) ; do kubectl certificate approve $i; sleep 1; done
@liubin
liubin / gist:92545beded509864af824022bc948d7c
Created August 2, 2018 10:11 — forked from tsuri/gist:ddcffce68e7737ce506172cd823bd5af
mixed normal and preemtible kubernetes cluster
# Kubernetes clusters using preemtible instances
## Motivation
People experimenting with kubernetes clusters on the GKE not
necessarily have money to keep a full cluster on at all time. GKE
clusters can be easily resized, but this still incurs in the full
instance cost when the cluster is up.
Google has added preemptible instances that are ideal for many