Skip to content

Instantly share code, notes, and snippets.

View zarinfam's full-sized avatar

Saeed Zarinfam zarinfam

View GitHub Profile
@zarinfam
zarinfam / gist.java
Created December 16, 2019 07:11
Created with Copy to Gist
View gist.java
@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!"));
}
View gist.sh
$ 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
View gist.sh
$ 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
View gist.sh
$ 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
View gist.sh
$ 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
View gist.sh
$ docker network create kafka-net --driver bridge
@zarinfam
zarinfam / gist.java
Created October 9, 2019 08:48
Created with Copy to Gist
View gist.java
var logger = (Serializable & LogReader) () -> readAllLogFileLines();
serializeIt(logger);
@zarinfam
zarinfam / gist.java
Last active October 9, 2019 08:45
Created with Copy to Gist
View gist.java
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
View gist.java
public static <T extends LogReader & LogStreamer> void streamLog(T logSystem){
logSystem.read().forEach(logSystem::stream);
}
@zarinfam
zarinfam / gist.java
Created October 1, 2019 11:58
Created with Copy to Gist
View gist.java
public static void streamLog(LogReaderStreamer logReaderStreamer){
logReaderStreamer.read().forEach(logReaderStreamer::stream);
}