Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

吴晟 Wu Sheng wu-sheng

🏠
Working from home
View GitHub Profile
@wu-sheng
wu-sheng / delete_git_submodule.md
Created Feb 8, 2020 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.
View delete_git_submodule.md

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
View application.yml
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
#
# Unless required by applicable law or agreed to in writing, software
@wu-sheng
wu-sheng / Interceptor.java
Created Jul 24, 2019
SkyWalking bootstrap instrumentation demo
View Interceptor.java
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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
*
View elasticsearch.yml
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
@wu-sheng
wu-sheng / my-misunderstandings.md
Created Mar 14, 2018 — forked from adriancole/my-misunderstandings.md
My take on: Misunderstanding "Open Tracing" for the Enterprise
View my-misunderstandings.md

This is a reaction post to Misunderstanding "Open Tracing" for the Enterprise by @jkowall

This is opinions with citations (imagine that!). This is not wikipedia. sorry. I didn't run this by anyone, Jonah or otherwise. I do not represent OpenTracing or OpenCensus (or my employer or whatever you might think) in this view. I will give critical thoughts on both from a technical view as people complained to me mostly about lack of details. I do have "a dog in the race" but it isn't what you might think. Yes, I'm the primary maintainer of Zipkin, but my goal is not to disparage anything rather to keep the community healthy with options that exist and free from the suffering caused in my opinion by complete lack of technical view on what things do. Particularly, this is dangerous in interop, and I'll get to that.

I have experience with both tools. Though I left within months, I was implicated in the beginning of OpenTracing. I still mainta

@wu-sheng
wu-sheng / BootstrapAgent.java
Created Jan 17, 2018 — forked from raphw/BootstrapAgent.java
An example agent that intercepts a method of the bootstrap class loader.
View BootstrapAgent.java
package net.bytebuddy;
import net.bytebuddy.agent.ByteBuddyAgent;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.ClassFileLocator;
import net.bytebuddy.dynamic.DynamicType;
import net.bytebuddy.dynamic.loading.ClassInjector;
import net.bytebuddy.implementation.MethodDelegation;
import net.bytebuddy.implementation.bind.annotation.SuperCall;
@wu-sheng
wu-sheng / PhysicalCores.java
Created Feb 8, 2017
Read the number of "physical" hardware threads available
View PhysicalCores.java
package veddan.physicalcores;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
@wu-sheng
wu-sheng / trace.proto
Created Jan 12, 2017
protobuf specification for google tracing
View trace.proto
// Copyright 2016 Google Inc.
//
// 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
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
View Java-instanceof-Performance.java
//Type.java
public enum Type { A, B, C, D, E, F, G, H, I, J };
// Base.java
public abstract class Base {
int i = 1;
final Type type;
public Base(Type type) {
@wu-sheng
wu-sheng / AgentBuilder.transform.java
Created Dec 29, 2016
byte-buddy agentBuilder.transform
View AgentBuilder.transform.java
/**
* https://github.com/stagemonitor/stagemonitor/blob/80793ac6c582944c9078b420138dda4d23517a69/stagemonitor-core/src/main/java/org/stagemonitor/core/instrument/AgentAttacher.java#L149-L166
*/
private static ClassFileTransformer initByteBuddyClassFileTransformer(AutoEvictingCachingBinaryLocator binaryLocator) {
AgentBuilder agentBuilder = createAgentBuilder(binaryLocator);
for (StagemonitorByteBuddyTransformer transformer : getStagemonitorByteBuddyTransformers()) {
agentBuilder = agentBuilder
.type(transformer.getMatcher())
.transform(transformer.getTransformer())
.asDecorator();
You can’t perform that action at this time.