Skip to content

Instantly share code, notes, and snippets.

FWIW: I (@Rondy) am not the author of the content presented here, which is an outline from Edmond Lau's book. I've just copy-pasted it from somewhere and saved as a personal gist, before it got popular on newsnews.ycombinator.com. I don't remember where exactly the original source is from and neither could find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

@vukhanhtruong
vukhanhtruong / openai-gpt-3.5-turbo.js
Last active March 13, 2023 11:09
Fetch OpenAI API code snippet in JS
try {
const GPT_KEY = process.env.CHATGPT_API_KEY;
const headers = {
'Content-Type': 'application/json',
Authorization: `Bearer ${GPT_KEY}`,
};
const prompt = req.query.text;
@vukhanhtruong
vukhanhtruong / semantic-commit-message-checker.yaml
Last active December 1, 2021 02:56
Github Actions for checking semantic commit message & task-id included
name: 'Semantic Commit Message Checker'
on:
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
check-commit-message:
@vukhanhtruong
vukhanhtruong / how-to-connect-from-docker-container-to-host.md
Last active September 9, 2021 09:13
How to connect from docker container to host

Two ways to reach host

  1. Use --network="host" in your docker run command, then 127.0.0.1 in your docker container will point to your docker host.

  2. Get host IP by running following command. Then you should reach the host from container.

ip addr show docker0 | grep -Po 'inet \K[\d.]+'

# 172.17.0.1
@vukhanhtruong
vukhanhtruong / configmap.yaml
Last active May 4, 2021 09:33
[Kubernetes] Nginx as a sidecar container sample.
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf-configmap
labels:
app: your-app
data:
nginx.conf: |-
error_log /dev/stdout info;
events {
@vukhanhtruong
vukhanhtruong / README.md
Last active February 19, 2021 07:08
Terraform, Helm, Nginx Ingress and Hello-world app

Usage

Start minikube

minikube start --driver=kvm2

Terraform apply

@vukhanhtruong
vukhanhtruong / README-Fancy.md
Created October 21, 2020 04:30 — forked from ramantehlan/README-Fancy.md
README template I use for most of my projects.

Introduction

  • Add your project logo.
  • Write a short introduction to the project.
  • If you are using badges, add them here.

📒 Index

@vukhanhtruong
vukhanhtruong / _Mattermost with automatic renew ssl.md
Last active September 19, 2020 02:27
Mattermost using the Docker setup together with nginx-proxy, using the LetsEncrypt companion container for nginx-proxy for automatic renew ssl.

Getting Started

First, create a Docker network. This enables container DNS, which allows containers to communicate with one another by name.

docker network create mattermostnw

Customize the nginx-proxy settings

  • Read the official Mattermost docker here
@vukhanhtruong
vukhanhtruong / README.md
Last active September 4, 2020 04:05
ExpressJS Local SSL

Generate SSL by mkcert

mkcert example.com "*.example.com" example.test localhost 127.0.0.1 ::1

Update express server

@vukhanhtruong
vukhanhtruong / README.md
Last active October 1, 2023 07:31
Multiple WordPress Sites on Docker with Letsencrypt

Host Multiple WordPress Sites behind Nginx Proxy

With the following “Docker recipe”, you will set up a Docker node running separate WordPress installation on two domains or subdomains. This setup is pretty much production ready, with:

  • nginx reverse proxy by Jason Wilder that automatically routes traffic to new containers that are created with the VIRTUAL_HOST=sub.domain.com environment variable. This nifty container performs a similar function to Traefik or HAProxy, but it is amazingly simple to use.
  • letsencrypt-nginx-proxy-companion by Yves Blusseau that obtains an SSL certificate from Let’s Encrypt, the free Certificate Authority, when you specify the LETSENCRYPT_HOST and LETS_ENCRYPT_EMAIL environment variables on any application container (i.e. WordPress) that needs to be served over HTTPS. The companion even pings Let’s Encrypt every 90 days to automatically renew your certificates!
  • Of