Skip to content

Instantly share code, notes, and snippets.

View zarinfam's full-sized avatar

Saeed Zarinfam zarinfam

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<profiles version="21">
<profile kind="CodeFormatterProfile" name="Default" version="21">
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
@zarinfam
zarinfam / gist.java
Created December 16, 2019 07:11
Created with Copy to Gist
@Autowired
private MockMvc mockMvc;
@Test
public void noParamGreetingShouldReturnDefaultMessage() throws Exception {
this.mockMvc.perform(get("/greeting")).andDo(print()).andExpect(status().isOk())
.andExpect(jsonPath("$.content").value("Hello, World!"));
}
$ docker run --name kafka-server2 --network kafka-net -e ALLOW_PLAINTEXT_LISTENER=yes -e KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper-server:2181 -e KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9093 -p 9093:9092 bitnami/kafka:latest -d
@zarinfam
zarinfam / gist.sh
Last active November 4, 2019 22:05
$ docker run --name kafka-server1 --network kafka-net -e ALLOW_PLAINTEXT_LISTENER=yes -e KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper-server:2181 -e KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 -p 9092:9092 bitnami/kafka:latest -d
@zarinfam
zarinfam / gist.sh
Last active November 4, 2019 06:19
Created with Copy to Gist
$ telnet localhost 2181
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
srvr
@zarinfam
zarinfam / gist.sh
Last active March 14, 2020 21:11
Created with Copy to Gist
$ docker run --name zookeeper-server -p 2181:2181 --network kafka-net -e ALLOW_ANONYMOUS_LOGIN=yes bitnami/zookeeper:latest -d
@zarinfam
zarinfam / gist.sh
Last active January 5, 2020 10:23
Created with Copy to Gist
$ docker network create kafka-net --driver bridge
@zarinfam
zarinfam / gist.java
Created October 9, 2019 08:48
Created with Copy to Gist
var logger = (Serializable & LogReader) () -> readAllLogFileLines();
serializeIt(logger);
@zarinfam
zarinfam / gist.java
Last active October 9, 2019 08:45
Created with Copy to Gist
LogReader logReader = (Serializable & LogReader) () -> readAllLogFileLines();
if (logReader instanceof Serializable){
System.out.println("it is Serializable");
}
serializeIt((Serializable) logReader);
@zarinfam
zarinfam / gist.java
Created October 2, 2019 13:53
Created with Copy to Gist
public static <T extends LogReader & LogStreamer> void streamLog(T logSystem){
logSystem.read().forEach(logSystem::stream);
}