Skip to content

Instantly share code, notes, and snippets.

View chenchun's full-sized avatar
🦖
go for{vacation()}

Chun Chen chenchun

🦖
go for{vacation()}
View GitHub Profile
@chenchun
chenchun / bond_vlan_bridge.md
Last active June 6, 2022 08:41
Linux vlan over bridge demo, VLAN bond bridge
@chenchun
chenchun / compact_vmdk.md
Last active July 13, 2020 08:17
Add another disk for your vagrant box, dd

http://vladimir-ivanov.net/how-to-compact-virtualboxs-vdmk-file-size/

  1. Fill the free space with zeros VirtualBox only knows that the space is really free if it’s been set to zero, and standard deletion won’t do this. Login into the virtual machine and run the following command:
cat /dev/zero > zero.fill; sync; sleep 1; sync; rm -f zero.fill
  1. compact vmdk
@chenchun
chenchun / CMakeLists.txt
Last active September 9, 2019 15:03
play with different kernel verison #cmake
cmake_minimum_required(VERSION 3.8)
project(linux C)
include_directories(include)
file(GLOB_RECURSE ALL_FILES
"*.h"
"*.c"
)
@chenchun
chenchun / irc-0
Last active November 18, 2015 03:12
irc, you need to be identified with services
/msg nickserv register [password] [email]
/msg nickserv identify [password]
@chenchun
chenchun / vxlan_multicast.sh
Created December 29, 2015 16:35
vxlan using l3 multicast to resolve location
# set up on host1 192.168.33.11, 08:00:27:f8:73:79
ip link add vxlan0 type vxlan id 42 group 239.1.1.1 dev eth1 dstport 4789
ip link set vxlan0 address 54:8:20:0:0:1
ip address add 10.0.0.1/8 dev vxlan0
ip link set up vxlan0
# set up on host2 192.168.33.12, 08:00:27:d9:18:aa
ip link add vxlan0 type vxlan id 42 group 239.1.1.1 dev eth1 dstport 4789
ip link set vxlan0 address 54:8:20:0:0:2
ip address add 10.0.0.2/8 dev vxlan0
/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license //@ sourceMappingURL=jquery.min.map */ (function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",
@chenchun
chenchun / db.md
Last active June 23, 2018 00:46
time series database, prometheus opentsdb influxdb Graphite

CAAS platform APP resource monitoring

APP resource monitoring

  • Data should be kept as long as Long time apps running
  • Data should be kept months after apps die
  • Support querying data per container
  • Support querying data per app
  • Support querying data per cluster
  • Tens of thousands of collectors
  • Load balancing multiple query engines
@chenchun
chenchun / opentsdb.md
Last active July 1, 2016 08:14
opentsdb
rest api
http://localhost:4242/api/query?start=1466564936&m=avg:20s-max:rate:cpu_usage_total{queue=gaia_queue,user=11,appName=rami_test,instance=3}
curl 'http://localhost:4242/api/query?start=1466564936&m=avg:20s-max:rate:cpu_usage_total\{queue=root.demo,user=null,appName=rami,instanceId=1\}'
put sys.cpu.user 1356998400 1 h=w1 c=0
put sys.cpu.user 1356998401 3 h=w1 c=1
put sys.cpu.user 1356998400 5 h=w2 c=0
@chenchun
chenchun / go.bash
Last active July 30, 2024 08:00
go cross compile, compile linux binary on mac osstatic compile, go memory cpu debug
go version < 1.5
cd /usr/local/go/src
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 ./make.bash --no-clean
all go version, compile your app
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -v .
env GOOS=linux GOARCH=amd64 go build -v .
@chenchun
chenchun / kubelet.md
Last active July 30, 2018 07:38
kubernetes kubelet component #kubernetes #kubelet

kubelet

Component

Ordered by the goroutine start time

  • eventBroadcaster
  • Watching apiserver
  • garbageCollection(containerGC/imageManager)
  • imageManager