Skip to content

Instantly share code, notes, and snippets.

View mrsinguyen's full-sized avatar
🎯
Focusing

Si Nguyen mrsinguyen

🎯
Focusing
View GitHub Profile
@mrsinguyen
mrsinguyen / docker-compose.local.yml
Created November 6, 2024 01:46
Local mysql 5.7 and adminer docker container, run 'docker-compose -f docker-compose.local.yml up -d'
version: '3.8'
services:
mysql_container:
platform: linux/x86_64
image: mysql:5.7
command: [ "mysqld", "--sql-mode=NO_ENGINE_SUBSTITUTION" ]
ports: [ '3306:3306' ]
volumes:
- './docker/run/mysql:/var/lib/mysql'
environment:
@mrsinguyen
mrsinguyen / compose.yaml
Created November 5, 2024 02:22 — forked from makhmudovrt/compose.yaml
Mongo 7 with a replica set with only one node in docker compose
version: "3.7"
services:
# simple
mongo:
image: mongo
command: mongod --replSet rs0 --bind_ip_all
healthcheck:
test: |
mongosh --eval "try { rs.status().ok } catch (e) { rs.initiate({ _id: 'rs0', members: [{ _id: 0, host: 'localhost:27017' }] }).ok }"

Notes on Martin Kleppmann's excellent Designing Data-Intensive Applications.

Chapter 1: Reliable, Scalable, and Maintainable Applications

  • Data Systems
    • Dimensions to consider when thinking about data systems: access patterns, performance characteristics, implementations.
    • Modern data systems often blur the lines between databases, caches, streams, etc.
  • Reliability
    • Systems should perform the expected function at a given level of performance, and be tolerant to faults and user mistakes
  • Fault: One component of a system deviating from its spec. Prefer tolerating faults over preventing them (except for things like security issues). Faults stem from hardware failures, software failures, and human error (in a study, config errors caused most outages).

Keybase proof

I hereby claim:

  • I am mrsinguyen on github.
  • I am mrsinguyen (https://keybase.io/mrsinguyen) on keybase.
  • I have a public key ASAqD2M8zZeIDa5vsxclq9Nfc0BoxlUegT6z-mKIgHk0zQo

To claim this, I am signing this object:

@mrsinguyen
mrsinguyen / node-and-npm-in-30-seconds.sh
Created December 3, 2020 06:35 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh

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

@mrsinguyen
mrsinguyen / na.md
Last active July 2, 2020 08:32
Từ điển tiếng Nghệ An
Con trâu thì gọi “con tru”
Con dâu thì gọi “con du” trong nhà
“Mấn” là “váy”, “ngái” là “xa”
“Đi mô?” để hỏi ai là “đi đâu? ”
“Nác su” ý nói “nước sâu”
“Trấy bù” để gọi “quả bầu” đấy nha
“Gác bếp” thì gọi là “tra”
“Lông cơn” thực chất đó là “trồng cây”
“Ra sân” thì nói “ra cươi”
@mrsinguyen
mrsinguyen / 00.imgproxy_vs_alternatives.md
Created May 4, 2020 08:06 — forked from DarthSim/00.imgproxy_vs_alternatives.md
imgproxy vs alternatives benchmark

imgproxy vs alternatives benchmark

Setup

  • c5.xlarge AWS instance: 4 CPUs, 8 GB RAM
  • Ubuntu 18.04
  • Go 1.12
  • Python 2.7
  • Vips 8.7.4
@mrsinguyen
mrsinguyen / mysql.sql
Created May 4, 2020 07:34
Show largest mysql tables
SELECT CONCAT(table_schema, '.', table_name),
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows,
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA,
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx,
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size,
ROUND(index_length / data_length, 2) idxfrac
FROM information_schema.TABLES
ORDER BY data_length + index_length DESC
LIMIT 10;
@mrsinguyen
mrsinguyen / ssh-to-pem
Created May 4, 2020 07:17
Convert SSH key to pem
# Generate the ssh key
ssh-keygen -t rsa -b 4096 -f /tmp/key
# Convert it to a PEM file
ssh-keygen -p -m PEM -f /tmp/key