This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# memusg -- Measure memory usage of processes | |
# Usage: memusg COMMAND [ARGS]... | |
# | |
# Author: Jaeho Shin <netj@sparcs.org> | |
# Created: 2010-08-16 | |
set -um | |
# check input | |
[ $# -gt 0 ] || { sed -n '2,/^#$/ s/^# //p' <"$0"; exit 1; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>hello world</p> | |
in | |
<embed src="https://www.cco.purdue.edu/student/resume/resumesamples.pdf" width="800" height="600"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _cp(a,b) ((a)<(b)) | |
//k+1's element. jilin's template | |
int kth_element(int n, int a[], int k){ | |
int l = 0, r = n-1, i, j, key; | |
while (l < r){ | |
for (i=l-1, j = r+1, key = a[(i+j)>>1]; i < j; ){ | |
// j--, i++ at beginning of the loop is because, if i < j but a[i] == a[j] == key | |
// then not progress any more. i, j points to end of range that is done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script for installing tmux on systems where you don't have root access. | |
# tmux will be installed in $HOME/local/bin. | |
# It's assumed that wget and a C/C++ compiler are installed. | |
# exit on error | |
set -e | |
TMUX_VERSION=1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################ | |
# how mock really work: just replace the attribute. | |
############################################################ | |
class MyClass(object): | |
def getname(self): | |
return 'real getname' | |
def fake_getname(): | |
return 'fake getname' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type Person struct{ | |
Name string | |
Age int | |
} | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# download github envoy repo. | |
cd ${PATH_TO_ENVOY_REPO} | |
# build | |
./ci/run_envoy_docker.sh './ci/do_ci.sh bazel.dev' | |
# start envoy with following config. | |
/tmp/envoy-docker-build/envoy/source/exe/envoy-fastbuild -c configs/istio-multiplexing.yaml | |
# Separate terminal. | |
# TCP, should see google web page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup() { | |
export NS="istio-system" | |
# export TAG=$(awk 'FNR == 2 {print substr($0,5) } ' .istio.mk) | |
export TAG="multi-0610-a" | |
export HUB="gcr.io/jianfeih-test" | |
echo $NS, $TAG | |
} | |
function remove_ns() { | |
setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://github.com/istio/proxy | |
git clone https://github.com/istio/istio | |
pushd istio | |
# Build the binary and docker first | |
make && make docker | |
# Get the command line to build proxyv2 image, this shows the artifact path for proxyv2 docker image | |
# say it's /golang/out/linux_amd64/release/docker_build/proxyv2 | |
make docker.push --dry-run | grep proxyv2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function send_req() { | |
ITER=${ITER:-3} | |
for i in `seq 0 $ITER`; do | |
echo "iteration $i starts...." | |
for from in "foo" "bar" "legacy"; do | |
for to in "foo"; do | |
echo "from ${from}.sleep to ${to}.httpbin"; kubectl exec $(kubectl get pod -l app=sleep -n ${from} -o jsonpath={.items..metadata.name}) -c sleep -n ${from} -- curl http://httpbin.${to}:8000/ip -s ; | |
done; | |
done; | |
echo "iteration $i ends...." |
OlderNewer