Skip to content

Instantly share code, notes, and snippets.

@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
@vukhanhtruong
vukhanhtruong / vcl-regex-cheat-sheet
Created June 17, 2020 02:20 — forked from dimsemenov/vcl-regex-cheat-sheet
Regular expression cheat sheet for Varnish (.vcl). Examples of vcl regexp. Found here http://kly.no/varnish/regex.txt (by Kristian Lyngstøl)
Regular expression cheat sheet for Varnish
Varnish regular expressions are NOT case sensitive. Varnish uses POSIX
regular expressions, for a complete guide, see: "man 7 regex"
Basic matching:
req.url ~ "searchterm"
True if req.url contains "searchterm" anywhere.
req.url == "searchterm"
@vukhanhtruong
vukhanhtruong / customize-mx-master-ubuntu.md
Last active December 4, 2022 13:48
Custom keymap for Logitech MX Master 2S mouse on Ubuntu

First, install Solaar to see the battery level on the taskbar

sudo apt-get install solaar

To remap the keys, install

sudo apt-get install xbindkeys xautomation
@vukhanhtruong
vukhanhtruong / deploy.md
Last active September 4, 2019 10:02
[Challenge] Configure a Firewall and a Startup Script with Deployment Manager
gcloud deployment-manager deployments create my-deployment --config qwiklabs.yaml
@vukhanhtruong
vukhanhtruong / index.js
Last active November 20, 2023 04:45
Google Cloud Functions to resize compute instance-group
const {Buffer} = require('safe-buffer');
const Compute = require('@google-cloud/compute');
const compute = new Compute();
/**
* Resize Compute Engine instance-group.
*
* Expects a PubSub message with JSON-formatted event data containing the
* following attributes:
* zone - the GCP zone the instances are located in.
@vukhanhtruong
vukhanhtruong / ._README.md
Last active March 24, 2025 01:14
Setup Javascript / Nodejs Project with ES6 + Babel 7 + ESLint + Airbnb + Prettier

Project Setup

Create a directory and run the following command.

npm init 

For this tutorial, I will be adding an index.js file to the src folder, and this will be our entry point. Our file directory should look like this.

@vukhanhtruong
vukhanhtruong / gist:7ecc9c515e051e963c222eb919b8b7f9
Created February 27, 2019 14:25 — forked from bcremer/gist:12167985b442d0d195de
NGINX as caching REST-API Proxy
upstream backend {
server localhost:8080;
#server backup1.example.com:8080 backup;
#server backup2.example.com:8080 backup;
}
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:10m;
# Set cache key to include identifying components