Skip to content

Instantly share code, notes, and snippets.

View jgeek's full-sized avatar

MohammadReza Kargar jgeek

  • Jumbo
  • Tehran, Iran
View GitHub Profile
@jgeek
jgeek / kafka_notes
Last active March 25, 2022 10:00
Kafka notes
The CLI have many options, but here are the other that are most commonly used:
Producer with keys
kafka-console-producer --broker-list 127.0.0.1:9092 --topic first_topic --property parse.key=true --property key.separator=,
> key,value
> another key,another value
Consumer with keys
--------
@jgeek
jgeek / gist:53e7d678c115fc9a7e06bf36bc7df87f
Created January 2, 2022 13:07 — forked from SzymonPobiega/gist:5220595
DDD/CQRS/ES/Architecture videos

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{http://www.infoq.com/presentations/ddd-eric-evans}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{http://www.infoq.com/presentations/design-strategic-eric-evans}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{http://www.infoq.com/presentations/SOA-Business-Autonomous-Components}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{http://www.infoq.com/presentations/Command-Query-Responsibility-Segregation}
  5. Greg Young's [Unshackle Your Domain]{http://www.infoq.com/presentations/greg-young-unshackle-qcon08}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht
@jgeek
jgeek / elasticsearch.txt
Last active March 25, 2022 10:57
elastic search
shards and reps
text field : ignore above
set 'doc_values'/'norms'/'index' for false to save disk if not necessary
set 'doc_values' to false: if sorting, scrpting and aggregation are not needed
setting norms to false: if relevance scoring is not needed
setting index to false: if do not need to filtering on values. still can be use for aggregation (time series)
set dynamic_mapping to strict
dont always map strings to text and keyword
disable corecion
integer is enough than long and float often cover our need instead of double
@jgeek
jgeek / mongo.txt
Created March 25, 2022 10:55
mongo commands
db.createUser(
{
user: "da",
pwd: "da@dp",
roles: [ { role: "root", db: "admin" } ]
}
)
@jgeek
jgeek / golang_gzip
Created December 2, 2024 08:15
golang gzip
package main
import (
"bytes"
"compress/gzip"
"fmt"
"encoding/base64"
"io/ioutil"
)