- Devtools global settings properties in the $HOME/.config/spring-boot folder when devtools is active.
- @TestPropertySource annotations on your tests.
- properties attribute on your tests. Available on @SpringBootTest and the test annotations for testing a particular slice of your application.
- Command line arguments.
- Properties from SPRING_APPLICATION_JSON (inline JSON embedded in an environment variable or system property).
- ServletConfig init parameters.
- ServletContext init parameters.
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
# rtt | |
tshark -r tcpdump_outfile -Tfields -e frame.time_relative -e tcp.analysis.ack_rtt|awk -F'\t' 'length($2) > 0 {print $2}' | |
# rto | |
tshark -r tcpdump_outfile -Tfields -e frame.time_relative -e tcp.analysis.rto|awk -F'\t' 'length($2) > 0 {print $2}' |
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
# replace 10.73 with your own network and 15138 with port | |
ss -ti|grep -E '10.73.[[:digit:]]{2,3}.[[:digit:]]{2,3}:15138' -A 1|grep 'ESTAB' -A 1|grep -v -- --|awk '{if(index($0, "ESTAB")) {h = $5} if(index($0, "rtt")) {split($4, a, "rtt:"); split(a[2], b, "/"); if(b[1] > r[h]) {r[h] = b[1]}}} END {for(h in r) print h, r[h]}' |
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
# total threads memory | |
grep -A 2 'stack:' /proc/$PID/smaps|grep Rss|awk '{m += $2} END {print m}' | |
# top ten threads | |
grep -A 2 'stack:' /proc/$PID/smaps|grep -v -- '--'|awk '{if(index($0, "stack")) {split($NF, a, "stack:"); split(a[2], b, "]"); s[i++] = b[1]} if(index($0, "Rss")) {v[b[1]] = $2}} END {for(t in s) print s[t], v[s[t]]}'|sort -k 2 -nr|head |
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 java.util.Arrays; | |
import java.util.List; | |
public class PrimitiveType { | |
public static void main(String[] args) { | |
byte[] x = new byte[]{1}; | |
char[] y = new char[]{1, 2}; | |
int[] z = new int[]{1}; | |
long[] j = new long[]{1L}; |
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 java.util.Arrays; | |
import java.util.List; | |
class DefaultClassShow { | |
public static void main(String... args) { | |
byte[] b = new byte[]{1, 2, 3}; | |
char[] c = new char[]{1, 2, 3}; |
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 java.net.NetworkInterface; | |
import java.util.Enumeration; | |
public class ListInterfaces { | |
public static void main(String[] args) { | |
try { | |
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); | |
while (interfaces.hasMoreElements()) { | |
System.out.println("interface " + interfaces.nextElement().getName()); |
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
from kafka import KafkaConsumer, TopicPartition | |
def get_topic_offsets(bootstrap_servers, topic, n_partition, ts): | |
consumer = KafkaConsumer(bootstrap_servers=bootstrap_servers) | |
return consumer.offsets_for_times({TopicPartition(topic, i): ts for i in range(n_partition)}) |
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 bs4 | |
import requests | |
def parse_ts(s): | |
s = s.strip() | |
v, unit = s.split(' ')[:2] | |
v = float(v) | |
if unit == 'ms': |
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
#include "stdio.h" | |
#include "numpy/arrayobject.h" | |
#include "numpy/ufuncobject.h" | |
// compile with comamnd `gcc -I/usr/local/lib/python3.6/site-packages/numpy/core/include $(python3.6m-config --cflags) test_ufunc_type_size.c` | |
int main(int argc, char * argv[]) { | |
printf("ufunc type size is %ld.\n", sizeof(PyUFuncObject)); | |
return 0; |