Skip to content

Instantly share code, notes, and snippets.

View mingliangguo's full-sized avatar

Mingliang mingliangguo

View GitHub Profile
@mingliangguo
mingliangguo / log4j2-config.md
Created December 2, 2019 00:05
lo4j2 configuration

log4j2 configuration

Configuration automatic reload

When configured from a File, Log4j has the ability to automatically detect changes to the configuration file and reconfigure itself. If the monitorInterval attribute is specified on the configuration element and is set to a non-zero value then the file will be checked the next time a log event is evaluated and/or logged and the monitorInterval has elapsed since the last check. The example below shows how to configure the attribute so that the configuration file will be checked for changes only after at least 30 seconds have elapsed. The minimum interval is 5 seconds.

<?xml version="1.0" encoding="UTF-8"?>
<Configuration monitorInterval="30">
...
@mingliangguo
mingliangguo / HystrixTest.java
Created September 6, 2019 13:31
Hystrix test example
@RunWith(SpringRunner.class)
@SpringBootTest
public class HystrixProxyServiceTests {
@MockBean
private MyRepo myRepo;
@Autowired
private MyService myService;
@mingliangguo
mingliangguo / debug_interceptor.java
Created August 21, 2019 15:18
debug_interceptors
public static class DebugHandlerInterceptorAdapter extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
try {
String responseText = IOUtils.toString(request.getReader());
System.out.println("response is:" + responseText);
} catch (IOException e) {
e.printStackTrace();
@mingliangguo
mingliangguo / hub-config.md
Created August 8, 2019 02:21
hub configuration

hub website for the rescue

https://hub.github.com/hub.1.html

configure url for enterprise github

git config --global --add hub.host MY.GIT.ORG 

when opening Pull request, make sure you export GITHUB_TOKEN

@mingliangguo
mingliangguo / jwtRS256.sh
Created July 18, 2019 12:44 — forked from Holger-Will/jwtRS256.sh
generate public private key pair (RSA RS256) for use with koa-jwt jasonwebtoken etc.
# generate private key
openssl genrsa -out private.pem 2048
# extatract public key from it
openssl rsa -in private.pem -pubout > public.pem
@mingliangguo
mingliangguo / pyenv.md
Created June 11, 2019 16:50
pyenv installation issue
@mingliangguo
mingliangguo / gist:8a5eb4a518354622dd5bd788be7fc1c7
Created May 7, 2019 03:07 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes:

@mingliangguo
mingliangguo / multiline-regexp.js
Created April 11, 2019 13:38 — forked from shannonmoeller/multiline-regexp.js
Multiline Regular Expressions using ES6 Template Strings
/**
* Inspired by XRegExp via 2ality
* http://www.2ality.com/2012/12/template-strings-xregexp.html
* http://xregexp.com/
*/
import test from 'ava';
export function rx(flags) {
const trailingComments = /\s+#.*$/gm;
@mingliangguo
mingliangguo / PRsByPerson.graphql
Created March 28, 2019 15:48
PRsByPerson.graphql
query myPullRequests {
search(query: "org:mingliangguo type:pr state:open author:mingliangguo", type: ISSUE, first: 100) {
issueCount
pageInfo {
endCursor
hasNextPage
}
edges {
cursor
node {
@mingliangguo
mingliangguo / websocat-install.sh
Last active August 29, 2024 13:13
install websocat in ubuntu
# libssl-dev and pkg-config are required in order to build websocat
#
apt-get update && apt-get install -y curl build-essential libssl-dev pkg-config
curl https://sh.rustup.rs -sSf | sh
export PATH=$HOME/.cargo/bin:$PATH
cargo install --features=ssl websocat