Skip to content

Instantly share code, notes, and snippets.

View muhammadghazali's full-sized avatar

Muhammad Ghazali muhammadghazali

View GitHub Profile
let update = {
$set: {
hello: {
world: 'anything'
}
}
};
@muhammadghazali
muhammadghazali / regex-to-test-decimal-fraction-second-in-iso-8601.js
Created November 29, 2016 15:41
Regex to test whether the decimal fraction seconds is found or not in ISO 8601 datetime string
// the regex is generated using https://txt2re.com
// Time Stamp 1
var re1='((?:2|1)\\d{3}(?:-|\\/)(?:(?:0[1-9])|(?:1[0-2]))(?:-|\\/)(?:(?:0[1-9])|(?:[1-2][0-9])|(?:3[0-1]))(?:T|\\s)(?:(?:[0-1][0-9])|(?:2[0-3])):(?:[0-5][0-9]):(?:[0-5][0-9]))';
// Any Single Character 1
var re2='(\\.)';
// Any Single Digit 1
var re3='(\\d)';
// Any Single Digit 2
var re4='(\\d)';
// Any Single Digit 3
@muhammadghazali
muhammadghazali / do I need to reload the nginx when one of server blocks config changes?
Created November 18, 2016 07:05
do I need to reload the nginx when one of server blocks config changes?
TBD
@muhammadghazali
muhammadghazali / What is server_names_hash_bucket_size.md
Last active February 9, 2024 14:13
Nginx: What is server_names_hash_bucket_size?

Background

While I'm learning how to use Nginx, I was instructed to update the server_names_hash_bucket_size (/etc/nginx/nginx.conf) value from 32 to 64, but I don't understand why should I increase the value to 64.

References

References that have been read so far:

@muhammadghazali
muhammadghazali / npm-debug.log
Last active October 21, 2016 08:58
npm ERR! code ENOENT during npm install caused by failed to locate specific directory
96048 silly gunzTarPerm extractEntry array/last.js
96049 silly gunzTarPerm modified mode [ 'array/last.js', 420, 436 ]
96050 silly gunzTarPerm extractEntry array/lastIndexOf.js
96051 silly gunzTarPerm modified mode [ 'array/lastIndexOf.js', 420, 436 ]
96052 silly gunzTarPerm extractEntry array/object.js
96053 silly gunzTarPerm modified mode [ 'array/object.js', 420, 436 ]
96054 silly gunzTarPerm extractEntry array/pull.js
96055 silly gunzTarPerm modified mode [ 'array/pull.js', 420, 436 ]
96056 silly gunzTarPerm extractEntry array/intersection.js
96057 silly gunzTarPerm modified mode [ 'array/intersection.js', 420, 436 ]
@muhammadghazali
muhammadghazali / tag.sh
Created August 10, 2016 10:48
Build the image with specific tag and push it
#!/bin/bash
docker build -t dockerhub-username/repository-name:0.10 .
docker push dockerhub-username/repository-name:0.10
@muhammadghazali
muhammadghazali / Secure Sessions Howto
Created June 23, 2016 18:49 — forked from nikmartin/A: Secure Sessions Howto
Secure sessions with Node.js, Connect, and Nginx as an SSL Proxy
Secure sessions are easy, but it's not very well documented, so I'm changing that.
Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy:
The desired configuration for using NginX as an SSL proxy is to offload SSL processing
and to put a hardened web server in front of your Node.js application, like:
[NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [CLIENT]
To do this, here's what you need to do: