Skip to content

Instantly share code, notes, and snippets.

View hugo53's full-sized avatar
🏆
On new thing

Hoang Nguyen hugo53

🏆
On new thing
View GitHub Profile
@staltz
staltz / music.md
Last active September 29, 2023 15:42
coding music

Not for everyone. Each programmer has their own appreciation of what is good coding music.

For when I need to think deep, debug something, or design

(From most influential to least)

@ursuad
ursuad / kafka-cheat-sheet.md
Last active March 14, 2024 10:32
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@duydo
duydo / gist:ac4358ec3bddcaba02cf347369923674
Last active July 26, 2017 07:12
ES mapping example to keep special chars
PUT test_index
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0,
"analysis": {
"analyzer": {
"test_analyzer": {
"type":"custom",
"tokenizer": "whitespace",
@dinhhoanglong91
dinhhoanglong91 / elasticsearch_cluster.md
Last active October 18, 2021 16:05
Elasticsearch Cluster

Node 1

IP: 192.168.33.10

cluster_name: dinhhoanglong91
node.name: node-vagrant-1
node.master: true
network.host: 192.168.33.10
discovery.zen.ping.unicast.hosts: ["192.168.33.10", "192.168.33.20"]
@saurabhmishra
saurabhmishra / Benchmark-results.txt
Last active August 12, 2019 14:24 — forked from jkreps/benchmark-commands.txt
Kafka Benchmark Commands
End-to-end Latency
0.0543 ms ms (median)
0.003125 ms (99th percentile)
5 ms (99.9th percentile)
Producer and consumer
Producer - 1431170.2 records/sec (136.49 MB/sec)
Consumer - 3276754.7021 records/sec (312.4957 MB/sec)
@ankurk91
ankurk91 / git_remember_password.md
Last active May 17, 2024 03:46
Git credential cache, why type password again and again

Tired of entering password again and again ?

Run this command to remember your password:

git config --global credential.helper 'cache --timeout 28800'

Above command will tell git to cache your password for 8 hours.

@Integralist
Integralist / Redis vs Memcache.md
Last active February 7, 2024 13:56
Redis vs Memcache

When deciding between Memcached and Redis, here are a few questions to consider:

  • Is object caching your primary goal, for example to offload your database? If so, use Memcached.
  • Are you interested in as simple a caching model as possible? If so, use Memcached.
  • Are you planning on running large cache nodes, and require multithreaded performance with utilization of multiple cores? If so, use Memcached.
  • Do you want the ability to scale your cache horizontally as you grow? If so, use Memcached.
  • Does your app need to atomically increment or decrement counters? If so, use either Redis or Memcached.
  • Are you looking for more advanced data types, such as lists, hashes, and sets? If so, use Redis.
  • Does sorting and ranking datasets in memory help you, such as with leaderboards? If so, use Redis.
  • Are publish a
@markrendle
markrendle / explanation.md
Last active July 3, 2022 07:56
Why I was previously not a fan of Apache Kafka

Update, September 2016

OK, you can pretty much ignore what I wrote below this update, because it doesn't really apply anymore.

I wrote this over a year ago, and at the time I had spent a couple of weeks trying to get Kafka 0.8 working with .NET and then Node.js with much frustration and very little success. I was rather angry. It keeps getting linked, though, and just popped up on Hacker News, so here's sort of an update, although I haven't used Kafka at all this year so I don't really have any new information.

In the end, we managed to get things working with a Node.js client, although we continued to have problems, both with our code and with managing a Kafka/Zookeeper cluster generally. What made it worse was that I did not then, and do not now, believe that Kafka was the correct solution for that particular problem at that particular company. What they were trying to achieve could have been done more simply with any number of other messaging systems, with a subscriber reading messages off and writing

@rduplain
rduplain / haproxy-servers.cfg
Last active June 10, 2022 13:23
Rewrite haproxy configuration and reload service.
# Edit this file then run `update-haproxy haproxy-servers.cfg`.
# Alternatively, use a shell pipeline to build server list `... | update-haproxy`.
server demo1 127.0.0.1:8001 check cookie demo1 weight 100
server demo2 127.0.0.1:8002 check cookie demo2 weight 100
server demo3 127.0.0.1:8003 check cookie demo3 weight 0
server demo4 127.0.0.1:8004 check cookie demo3 weight 0
@lolzballs
lolzballs / HelloWorld.java
Created March 22, 2015 00:21
Hello World Enterprise Edition
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class HelloWorld{
private static HelloWorld instance;
public static void main(String[] args){
instantiateHelloWorldMainClassAndRun();