Skip to content

Instantly share code, notes, and snippets.

View jgeek's full-sized avatar

MohammadReza Kargar jgeek

  • MCI
  • Tehran, Iran
View GitHub Profile
@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 / 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 / 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 / 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
--------
Liskov Substitution Principle:
http://www.blackwasp.co.uk/squarerectangle.aspx
https://www.baeldung.com/solid-principles
@jgeek
jgeek / cassandra_notes
Last active October 5, 2020 16:03
Cassandra notes
Cassandra uses a special type of primary key called a composite key (or compound
key) to represent groups of related rows, also called partitions. The composite key
consists of a partition key, plus an optional set of clustering columns. The partition key
is used to determine the nodes on which rows are stored and can itself consist of mul‐
tiple columns. The clustering columns are used to control how data is sorted for stor‐
age within a partition. Cassandra also supports an additional construct called a static
column, which is for storing data that is not part of the primary key but is shared by
every row in a partition.
So the outermost structure in Cassandra is the cluster, sometimes called
@jgeek
jgeek / scala_notes
Last active October 20, 2020 15:20
scala notes
https://booksites.artima.com/programming_in_scala_4ed/examples/
loan pattern: open a resource,operate on it, and then close the resource.
function literals, and function values
Scala supports first-class functions, which means you can express functions in
function literal syntax, i.e., (x: Int) => x + 1 ,
and that functions can be represented by objects, which are called function values.
function literals and
values is that function literals exist in the source code, whereas function val-
@jgeek
jgeek / apache_solr
Last active May 30, 2016 11:05
apache solr
# foreground and verbous
$ solr start -f -p 81 -V
# create core
$ ./solr create -c hellosolr
# -m heap size
$ solr start -p 8983 -h localhost -m 4g
# create core from sample config
@jgeek
jgeek / play _framework
Created May 15, 2016 11:24
play framework
activator -Dactivator.checkForUpdates=false -jvm-debug 9999
@jgeek
jgeek / bootstrap
Created May 12, 2016 14:22
bootstrap
http://startbootstrap.com/template-overviews/thumbnail-gallery/