Skip to content

Instantly share code, notes, and snippets.

@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
@vukhanhtruong
vukhanhtruong / Kong-JWT.md
Last active November 21, 2018 09:24
Example to use JWT with Kong API Gateway
@vukhanhtruong
vukhanhtruong / README.md
Last active September 15, 2017 04:47 — forked from magnetikonline/README.md
AWS Elastic Beanstalk deploy user restricted IAM policy.

AWS Elastic Beanstalk deploy user restricted IAM policy

An IAM user policy document to give minimal rights for deploying an Elastic Beanstalk application.

Where:

  • REGION: AWS region.
  • ACCOUNT_ID: AWS account ID.
  • APPLICATION_NAME: Desired target Elastic Beanstalk application name(space).
  • IAM_INSTANCE_PROFILE_ROLE: The instance profile (IAM role) Elastic Beanstalk EC2 instaces will run under.