Skip to content

Instantly share code, notes, and snippets.

View anfernee's full-sized avatar

Yongkun Anfernee Gui anfernee

  • Google
  • San Francisco Bay area
View GitHub Profile
/* **********************************************************************
* Copyright 2013 VMware, Inc. All rights reserved. VMware Confidential
* **********************************************************************
* $Id$
* $DateTime$
* $Change$
* $Author$
* *********************************************************************/
OneFsClient client = new DefaultOneFsClient("http://localhost:8080", "user", "pass", null);
OneFsNfsExport nfsExport = new OneFsNfsExport();
nfsExport.setId("1");
nfsExport.setBlockSize(1234L);
nfsExport.setSymblinks(true);
nfsExport.setUnresolvedClients(new ArrayList<String>());
client.create(nfsExport);
from concurrent import futures
from tornado import escape, gen, web
from tornado.wsgi import WSGIContainer
class WSGIHandler(web.RequestHandler):
thread_pool_size = 10
def initialize(self, wsgi_application):
self.wsgi_application = wsgi_application
# Demo of wrong handling of tcp connection
# if we shutdown the write end without closing the connection, the fd will
# still be there, while the network connection is gone. It will lead to an
# open fd leak. Basically it appears in lsof, not in netstat.
# lsof output:
# python 12594 vagrant 8u sock 0,7 0t0 74285 can't identify protocol
# ...
class Defer(object):
""" Defer is the idea stolen from golang. Instead of calling a function
immediately, it defers running the function by saving it to a list. The
saved list of functions get executed when the surrounding function returns.
"""
def __init__(self):
self.funcs = []
def defer(self, func, args=()):
cell "mongodb" {
name = "MongoDB Cell"
version = "1.0"
# Shameless borrow the term from hashicorp team. Or we use process group.
molecule "mongos" {
name = "MongoDB sharding"
scalable = true # Means user is able to scale the molecule up/down
requires = ["config"] # Define the molecule has be provisioned before this been provisioned
dtrace: 6923 dynamic variable drops with non-empty dirty list
SYSCALL(args) = return
thread_selfid(0x0, 0x0, 0x0) = 648613 0
csops(0x0, 0x0, 0x7FFF5FBFF198) = 0 0
issetugid(0x0, 0x0, 0x7FFF5FBFF198) = 0 0
shared_region_check_np(0x7FFF5FBFD0D8, 0x0, 0x7FFF5FBFF198) = 0 0
stat64("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x7FFF5FBFE268, 0x7FFF5FBFF198) = 0 0
open("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x0, 0x0) = 3 0
pread(0x3, "\312\376\272\276\0", 0x1000, 0x0) = 4096 0
pread(0x3, "\317\372\355\376\a\0", 0x1000, 0x1000) = 4096 0

Keybase proof

I hereby claim:

  • I am anfernee on github.
  • I am gui (https://keybase.io/gui) on keybase.
  • I have a public key ASAW4sMeqY0oL0IZHwF-6stvKx4J5b7nS1YBU6TKzRSV5go

To claim this, I am signing this object:

@anfernee
anfernee / enable_root_ssh.sh
Created April 27, 2017 22:04
enable_root_ssh
sed -i 's/^PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config
systemctl restart sshd
@anfernee
anfernee / make
Last active November 21, 2017 22:16
minikube-e2e
# out/e2e-linux-amd64 '-minikube-start-args=--vm-driver=vmware --kubernetes-version=file:///home/anfernee/go/src/k8s.io/minikube/out/localkube' '-minikube-args=--v=10 --logtostderr --bootstrapper=localkube' -test.v -test.timeout=5m -binary=out/minikube-linux-amd64
# windows
out/e2e-windows-amd64.exe -minikube-start-args="--vm-driver=virtualbox --kubernetes-version=https://storage.googleapis.com/minikube-builds/$env:MINIKUBE_LOCATION/localkube" -minikube-args="--v=10 --logtostderr" -binary=out/minikube-windows-amd64.exe -test.v -test.timeout=30m
out/e2e-linux-amd64 '-minikube-start-args=--vm-driver=virtualbox --kubernetes-version=v1.8.0' '-minikube-args=--v=10 --logtostderr --bootstrapper=localkube' -test.v -test.timeout=30m -binary=out/minikube-linux-amd64
=== RUN TestDocker
Environment=DOCKER_RAMDISK=yes FOO=BAR BAZ=BAT
ExecStart={ path=/usr/bin/dockerd ; argv[]=/usr/bin/dockerd -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.p