Skip to content

Instantly share code, notes, and snippets.

Sharing is caring

Thang Chung thangchung

Sharing is caring
View GitHub Profile

Some of the Redis best practices content has moved

This content from this markdown file has moved a new, happier home where it can serve more people. Please check it out :

NOTE: Client specific guidance listed below is still valid and should still be considered. I will update this document once all content has been moved.

View CachePipelineBehavior.cs
public class CachePipelineBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
private readonly IDistributedCache cache;
private readonly ILogger<SGUKAspNetCore> logger;
public CachePipelineBehavior(
IDistributedCache cache,
ILogger<SGUKAspNetCore> logger)
Ensure.Argument.NotNull(cache, nameof(cache));
thangchung / latency.txt
Created Sep 29, 2020 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
thangchung / BaseRepository.cs
Created Jul 20, 2020 — forked from pmbanugo/BaseRepository.cs
Implementation of the Repository and UnitOfWork pattern using Entity Framework.
View BaseRepository.cs
// A generic base repository which other repositories (if needed) can inherit from
public class BaseRepository<TEntity> : IEntityRepository<TEntity> where TEntity : class
internal DataContext context;
internal DbSet<TEntity> dbSet;
public BaseRepository(DataContext context)
this.context = context;
View gist:615e0be25ca7dca8cc99d4ead14e5925
kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
thangchung / psql_useful_stat_queries.sql
Created Apr 24, 2020 — forked from anvk/psql_useful_stat_queries.sql
List of some useful Stat Queries for PSQL
View psql_useful_stat_queries.sql
--- PSQL queries which also duplicated from
--- some of them taken from
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
-- Basics --
-- Get indexes of tables
View My VS Code Extensions
code --install-extension adpyke.codesnap
code --install-extension alefragnani.Bookmarks
code --install-extension alexdima.copy-relative-path
code --install-extension azuredevspaces.azds
code --install-extension be5invis.vscode-custom-css
code --install-extension cake-build.cake-vscode
code --install-extension christian-kohler.npm-intellisense
code --install-extension CoenraadS.bracket-pair-colorizer
code --install-extension donjayamanne.githistory
code --install-extension eamodio.gitlens
thangchung /
Created Mar 10, 2020 — forked from Ryanb58/
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
v3.7.0-243-gf26e75a186 []
v3.7.0-229-g087f28e29d []
View Rough Notes about CQRS and

Rough Notes about CQRS and ES

Once upon a time…

I once took notes (almost sentence by sentence with not much editing) about the architectural design concepts - Command and Query Responsibility Segregation (CQRS) and Event Sourcing (ES) - from a presentation of Greg Young and published it as a gist (with the times when a given sentence was heard).

I then found other summaries of the talk and the gist has since been growing up. See the revisions to know the changes and where they came from (aka the sources).

It seems inevitable to throw Domain Driven Design (DDD) in to the mix.

You can’t perform that action at this time.