This file contains hidden or 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
| import org.springframework.util.MultiValueMap; | |
| public class GatewayContext { | |
| public static final String CACHE_GATEWAY_CONTEXT = "cacheGatewayContext"; | |
| /** | |
| * cache json body |
This file contains hidden or 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
| vi pdmonitor.sh | |
| ########### | |
| #!/bin/sh | |
| while true | |
| do | |
| date | |
| ps -p [PID] -o %cpu,%mem | |
| sleep 5 |
This file contains hidden or 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
| import org.apache.http.client.config.RequestConfig; | |
| import org.apache.http.impl.client.CloseableHttpClient; | |
| import org.apache.http.impl.client.HttpClientBuilder; | |
| import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.context.annotation.Configuration; | |
| @Configuration | |
| public class ClientHttpPoolConfiguration { |
This file contains hidden or 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
| netstat -anp | grep :80 | grep ESTABLISHED | wc -l | |
| netstat -anp | grep :80 | grep WAITED | wc -l |
This file contains hidden or 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
| https://www.cedric-dumont.com/2017/02/01/install-apache-benchmarking-tool-ab-on-windows/ | |
| https://www.apachelounge.com/download/ | |
| ab -n 100 -c 10 http://yourserver/yourapi | |
| # content.json contains the json you want to post | |
| # -p means to POST it | |
| # -H adds an Auth header (could be Basic or Token) | |
| # -T sets the Content-Type |
This file contains hidden or 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 com.cloud.gateway.app; | |
| import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.setResponseStatus; | |
| import org.springframework.cloud.gateway.filter.GatewayFilter; | |
| import org.springframework.cloud.gateway.filter.GatewayFilterChain; | |
| import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory; | |
| import org.springframework.cloud.gateway.support.HttpStatusHolder; | |
| import org.springframework.http.HttpMethod; | |
| import org.springframework.http.HttpStatus; |
This file contains hidden or 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
| System.out.println(env); | |
| List<InstanceInfo> instanceList = dc.getApplication("USER-SERVICE").getInstances().stream().filter(f->{ | |
| return f.getMetadata() != null && env.equals(f.getMetadata().get("env")); | |
| }).collect(Collectors.toList()); | |
| int randomElementIndex | |
| = ThreadLocalRandom.current().nextInt(instanceList.size()) % instanceList.size(); | |
| InstanceInfo instanceInfo = instanceList.get(randomElementIndex); | |
| System.out.println(instanceInfo.getHomePageUrl()); | |
This file contains hidden or 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/sh | |
| cat >dependencies.dot <<EOF | |
| digraph g { | |
| graph [ | |
| rankdir = "LR" | |
| ]; | |
| node [ | |
| fontsize = "12" | |
| fontname = "Courier" |
This file contains hidden or 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
| void insertIntoMDC(ServletRequest request, String userName) { | |
| MDC.put(USER_NAME_MDC_KEY, userName); | |
| MDC.put(ClassicConstants.REQUEST_REMOTE_HOST_MDC_KEY, request.getRemoteHost()); | |
| if (request instanceof HttpServletRequest) { | |
| HttpServletRequest httpServletRequest = (HttpServletRequest) request; | |
| MDC.put(ClassicConstants.REQUEST_REQUEST_URI, httpServletRequest.getRequestURI()); | |
| StringBuffer requestURL = httpServletRequest.getRequestURL(); | |
| if (requestURL != null) { | |
| MDC.put(ClassicConstants.REQUEST_REQUEST_URL, requestURL.toString()); |
This file contains hidden or 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
| xfreerdp +clipboard /u:admin /v:46.ip +toggle-fullscreen /w:1024 /h:768 /drive:shared,/home/omidp/temp |