Skip to content

Instantly share code, notes, and snippets.

View qudongfang's full-sized avatar
😃
Focusing

Dongfang Qu qudongfang

😃
Focusing
View GitHub Profile
@qudongfang
qudongfang / test.c
Created November 18, 2012 01:58
a bit of code
/*
左“{”,右”}"括号各N个,请打印出所有正确的组合,比如当N=3,{}{}{},{{{}}},等为正确的组合。如果写的代码是recursive,能否用iterative再写一个;反之亦然。
*/
// gcc -std=c99 test.c && ./a.out
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <assert.h>
@qudongfang
qudongfang / out_forward.rb
Last active August 29, 2015 13:56
fluentd out_forward plugin which forward event stream to astream collector
#
# Fluent
#
# Copyright (C) 2011 FURUHASHI Sadayuki
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@qudongfang
qudongfang / gist:10441713
Last active August 29, 2015 13:59
aqueducts_logstash_example.conf
input {
file {
# 详细配置项请参考http://logstash.net/docs/1.3.3/inputs/file
path => "/home/work/local/imas.log"
# 附加自定义字段
# add_field => { "input_a" => "input_a"
# "input_b" => "input_b"
# }
}
import sun.misc.Unsafe;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
public class Foo {
private boolean flag = true;
public boolean getFlag() {
### Keybase proof
I hereby claim:
* I am qudongfang on github.
* I am dongfang (https://keybase.io/dongfang) on keybase.
* I have a public key ASCIfbaHj0EKcHrmiqSGB73Gqyvht1fuIy71ES9_YD_b0Qo
To claim this, I am signing this object:
@qudongfang
qudongfang / add-x-cluster-client-ip-header.yaml
Created August 17, 2022 15:14
add headers via EnvoyFilter to all hosts and routes
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: add-x-cluster-client-ip-header
namespace: istio-system
spec:
configPatches:
- applyTo: ROUTE_CONFIGURATION
match:
context: SIDECAR_INBOUND
@qudongfang
qudongfang / istio-proxy.dockerfile
Last active August 29, 2024 22:18
istio-proxy docker image with customised envoy
ARG RELEASE=1.19.6
ARG SIDECAR=envoy
FROM gcr.io/istio-release/proxyv2:${RELEASE}
# Install Envoy.
COPY ./${SIDECAR} /usr/local/bin/${SIDECAR}
RUN chmod 0755 /usr/local/bin/${SIDECAR}
@qudongfang
qudongfang / istio_proxy_build.sh
Last active August 7, 2024 09:03
how to build istio-proxy images locally
RELEASE=1.19
git clone https://github.com/istio/proxy.git
cd proxy
git checkout ${RELEASE}
# make your changes to the source code
@qudongfang
qudongfang / gist:54963faf424a395abecbfa19ae15d1d3
Created January 31, 2024 14:54
compile istio-proxy for linux/amd64 on Mac M1
RELEASE=1.19
git clone https://github.com/istio/proxy.git
cd proxy
git checkout ${RELEASE}
# make your changes to the source code
@qudongfang
qudongfang / flow.md
Last active March 1, 2024 14:50
flow.md

AKS kubectl API traffic flow

graph TD;
    kubectl --> lb-b-mgmt[kube-1-eastus2-azure-cloud-dev.k8s-api.corp.mongodb.com];
    lb-b-mgmt[kube-1-eastus2-azure-cloud-dev.k8s-api.corp.mongodb.com] --> proxy-headless.kubectl.eastus2.azure.cloud-dev.svc.cluster.local:8080;
    proxy-headless.kubectl.eastus2.azure.cloud-dev.svc.cluster.local:8080 --> proxy_pods[socat pods running in namespace kubectl]
   proxy_pods[socat pods running in namespace kubectl] --> kubernetes.default.svc.cluster.local:443