Skip to content

Instantly share code, notes, and snippets.

View thangchung's full-sized avatar
:electron:
Sharing is caring

Thang Chung thangchung

:electron:
Sharing is caring
View GitHub Profile
@thangchung
thangchung / bootstrap-ubuntu.sh
Created August 18, 2023 03:59 — forked from vadim-kovalyov/bootstrap-ubuntu.sh
Dev box setup for Ubuntu 20.04
sudo apt update
sudo apt install -y build-essential curl make git vim hub libssl-dev graphviz jq cmake clang pkg-config p7zip terminator gnome-tweaks fonts-firacode protobuf-compiler
# intune
sudo apt install libpam-pwquality
sudo nano /etc/pam.d/common-password
# password requisite pam_pwquality.so retry=3 dcredit=-1 ocredit=-1 ucredit=-1 lcredit=-1 minlen=12
curl -sSl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@thangchung
thangchung / steve-yegge-platform-rant-follow-up.md
Created May 22, 2023 09:09 — forked from kislayverma/steve-yegge-platform-rant-follow-up.md
The one after platforms where Steve Yegge shares Amazon war stories

By Steve Yegge

Last week I accidentally posted an internal rant about service platforms to my public Google+ account (i.e. this one). It somehow went viral, which is nothing short of stupefying given that it was a massive Wall of Text. The whole thing still feels surreal.

Amazingly, nothing bad happened to me at Google. Everyone just laughed at me a lot, all the way up to the top, for having committed what must be the great-granddaddy of all Reply-All screwups in tech history.

But they also listened, which is super cool. I probably shouldn’t talk much about it, but they’re already figuring out how to deal with some of the issues I raised. I guess I shouldn’t be surprised, though. When I claimed in my internal post that “Google does everything right”, I meant it. When they’re faced with any problem at all, whether it’s technical or organizational or cultural, they set out to solve it in a first-class way.

Anyway, whenever something goes viral, skeptics start wondering if it was faked or staged. My accident

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@thangchung
thangchung / System Design.md
Created February 6, 2023 07:06 — forked from vasanthk/System Design.md
System Design Cheatsheet

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

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:

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

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

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 / 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

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