Skip to content

Instantly share code, notes, and snippets.

View michaelhenrique182's full-sized avatar

Michael Henrique michaelhenrique182

View GitHub Profile

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

Producer
Setup
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test --partitions 6 --replication-factor 3
Single thread, no replication
bin/kafka-run-class.sh org.apache.kafka.clients.tools.ProducerPerformance test7 50000000 100 -1 acks=1 bootstrap.servers=esv4-hcl198.grid.linkedin.com:9092 buffer.memory=67108864 batch.size=8196
@michaelhenrique182
michaelhenrique182 / tweet.json
Created April 14, 2019 18:51 — forked from jnatkins/tweet.json
Sample Tweet
{
   "retweeted_status": {
      "contributors": null,
      "text": "#Crowdsourcing – drivers already generate traffic data for your smartphone to suggest alternative routes when a road is clogged. #bigdata",
      "geo": null,
      "retweeted": false,
      "in_reply_to_screen_name": null,
      "truncated": false,
      "entities": {
         "urls": [],
@michaelhenrique182
michaelhenrique182 / CurrentTimeId.java
Created September 5, 2018 12:26 — forked from icella/CurrentTimeId.java
Java – Ways to Generate Unique Ids in Java
/**
* The object creation time can be set to object’s identifier property.
* For this purpose, System.currentTimeMillis() can be used. However,
* two or more objects may be created in a single millisecond.
* In this case, these objects will have the same id which is unacceptable.
* One way to cope with this problem is to use System.nanoTime().
* Even if the nano time is the smallest interval we can use, it does not
* also guarantee the uniqueness. To provide unique time stamps,
* I got help from AtomicReference class as follows.
*/
@michaelhenrique182
michaelhenrique182 / javascript-query-string.js
Created July 25, 2018 16:11 — forked from DavidWells/javascript-query-string.js
JavaScript :: Regex trick: Parse a query string into an object
// http://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object/
// JavaScript regex trick: Parse a query string into an object
var queryString = {};
anchor.href.replace(
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function($0, $1, $2, $3) { queryString[$1] = $3; }
);
// Usage
##################### ElasticSearch Configuration Example #####################
# This file contains an overview of various configuration settings,
# targeted at operations staff. Application developers should
# consult the guide at <http://elasticsearch.org/guide>.
#
# The installation procedure is covered at
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup.html>.
#
# ElasticSearch comes with reasonable defaults for most settings,
@michaelhenrique182
michaelhenrique182 / elasticsearch-cheatsheet.txt
Created June 9, 2018 18:27 — forked from stephen-puiszis/elasticsearch-cheatsheet.txt
Elasticsearch Cheatsheet - An Overview of Commonly Used Elasticsearch API Endpoints and What They Do
# Elasticsearch Cheatsheet - an overview of commonly used Elasticsearch API commands
# cat paths
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/indices
/_cat/indices/{index}
@michaelhenrique182
michaelhenrique182 / 01.ts
Created April 7, 2018 13:25 — forked from rahulrsingh09/01.ts
Angular HTTP
import {HttpClientModule} from '@angular/common/http';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
HttpClientModule
],
@michaelhenrique182
michaelhenrique182 / IntelliJ_IDEA__Perf_Tuning.txt
Created April 5, 2018 11:35 — forked from P7h/IntelliJ_IDEA__Perf_Tuning.txt
Performance tuning parameters for IntelliJ IDEA. Add these params in idea64.exe.vmoptions or idea.exe.vmoptions file in IntelliJ IDEA. If you are using JDK 8.x, please knock off PermSize and MaxPermSize parameters from the tuning configuration.
-server
-Xms2048m
-Xmx2048m
-XX:NewSize=512m
-XX:MaxNewSize=512m
-XX:PermSize=512m
-XX:MaxPermSize=512m
-XX:+UseParNewGC
-XX:ParallelGCThreads=4
-XX:MaxTenuringThreshold=1
@michaelhenrique182
michaelhenrique182 / gist:f0606dc1d552a8c5251efa2df4a77c5c
Last active January 19, 2018 18:52 — forked from ivan-loh/gist:ee0d96c3795e59244063
Node.JS ( & pm2 ) Process Memory Limit
# Plain Ol' Node
node --max_old_space_size=1024 app.js # increase to 1gb
node --max_old_space_size=2048 app.js # increase to 2gb
node --max_old_space_size=3072 app.js # increase to 3gb
node --max_old_space_size=4096 app.js # increase to 4gb
node --max_old_space_size=5120 app.js # increase to 5gb
node --max_old_space_size=6144 app.js # increase to 6gb
# For pm2
pm2 start app.js --node-args="--max_old_space_size=1024" # increase to 1gb