Skip to content

Instantly share code, notes, and snippets.

Avatar
:electron:
Sharing is caring

Thang Chung thangchung

:electron:
Sharing is caring
View GitHub Profile
@thangchung
thangchung / System Design.md
Created February 6, 2023 07:06 — forked from vasanthk/System Design.md
System Design Cheatsheet
View System Design.md

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@thangchung
thangchung / update-golang.md
Created February 2, 2023 09:13 — forked from nikhita/update-golang.md
How to update the Go version
View update-golang.md

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

View opa-vs-casbin.md

Information in this Gist originally from this github issue, which is outdated.

As @RomanMinkin mentioned, you can also consider Casbin (https://github.com/casbin/casbin). It is the most starred authorization library in Golang. There are several differences between Casbin and OPA.

Feature Casbin OPA
Library or service? Library/Service Library/Service
How to write policy? Two parts: model and policy. Model is general authorization logic. Policy is concrete policy rule. A single part: Rego
RBAC hierarchy Casbin supports role hierarchy (a role can have a sub-role) Role hierarchies can be encoded in data. Also with the new graph.reachable() built-in function queries over those hierarchies are much more feasible now.
RBAC separation of duties Not supported Supported: two roles cannot be assigned together
@thangchung
thangchung / README.md
Created December 9, 2022 03:44 — forked from corlaez/README.md
Hexagonal Architecture and Modular Implementation
View README.md

Hexagonal Architecture

Conceptualized by Alistair Cockburn. Also known as "Ports and Adapters".

In a nutshell:

Application Driver -> Primary Adapter -> Primary Port -> Use Case -> Secondary Port -> Secondary Adapter -> External System/Side Effect
@thangchung
thangchung / 2019-https-localhost.md
Created December 6, 2021 12:23 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains
View 2019-https-localhost.md

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@thangchung
thangchung / ca_post
Last active November 8, 2021 09:52
clean-architecture snippets
View ca_post
app.MapPost("/v1/api/order",
async (SubmitOrder.Command model, ISender sender) => await sender.Send(model));
@thangchung
thangchung / 2021-11
Last active November 2, 2021 16:24
My vscode extensions
View 2021-11
code --install-extension Adaptilab.grok
code --install-extension adpyke.codesnap
code --install-extension adrianwilczynski.namespace
code --install-extension alefragnani.Bookmarks
code --install-extension alexdima.copy-relative-path
code --install-extension antfu.slidev
code --install-extension be5invis.vscode-custom-css
code --install-extension bungcip.better-toml
code --install-extension cake-build.cake-vscode
code --install-extension christian-kohler.npm-intellisense
@thangchung
thangchung / history-lima-installation.md
Created September 17, 2021 08:12 — forked from toricls/lima-on-m1-mac-installation-guide.md
Using Lima to run containers with containerd and nerdctl (without Docker Desktop) on M1 Macs
View history-lima-installation.md

Used M1 Mac mini 2020 with macOS Big Sur Version 11.5.2.

1. Install Patched QEMU

According to the GitHub issue comment in Lima's GitHub repository, Lima requires a patched QEMU on M1 Macs.

Note that the followings are customized steps by @toricls based on the original steps and the script. Be sure to check the original files when you try it on your own.

Install QEMU on Silicon based Apple Macs

View distributed-monolith-vs-microservices.md

From You're not actually building microservices

So, are you building microservices? Take a look at a few of these symptoms, and decide for yourself:

  • A change to one microservice often requires changes to other microservices
  • Deploying one microservice requires other microservices to be deployed at the same time
  • Your microservices are overly chatty
  • The same developers work across a large number of microservices
  • Many of your microservices share a datastore
  • Your microservices share a lot of the same code or models
@thangchung
thangchung / Event-stream based GraphQL subscriptions.md
Created September 1, 2021 03:09 — forked from OlegIlyenko/Event-stream based GraphQL subscriptions.md
Event-stream based GraphQL subscriptions for real-time updates
View Event-stream based GraphQL subscriptions.md

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.