Skip to content

Instantly share code, notes, and snippets.

View nguyenchilong's full-sized avatar

Long Nguyen nguyenchilong

  • Vietnam
  • 18:56 (UTC +07:00)
  • LinkedIn in/longnc
View GitHub Profile
@nguyenchilong
nguyenchilong / waf-smoke-test.sh
Created April 15, 2025 07:38 — forked from ridjex/waf-smoke-test.sh
Lightweight Bash script to test basic WAF (Web Application Firewall) protections against common SQL injection and XSS payloads. Use this to quickly assess your web application’s surface against low-hanging injection vulnerabilities.
#!/bin/bash
# 🚀 Discover More: Testing Your Firewall in 60 Seconds: A Lightweight WAF Testing Script That Anyone Can Use
# Learn how this script works and the best practices for WAF testing.
# Read the full article here:
# 👉 https://medium.com/@kochuraa/testing-your-firewall-in-60-seconds-a-lightweight-waf-testing-script-that-anyone-can-use-a7a725fefcb7
# Safe WAF Tester Script
# Usage: ./waf-smoke-test.sh <URL> [-o output.md] [-H "Header: Value"]
# Examples:
@nguyenchilong
nguyenchilong / README.md
Created February 3, 2021 10:57 — forked from mrbar42/README.md
Secured HLS setup with Nginx as media server

Secured HLS setup with Nginx as media server

This example is part of this article.

This is an example for an HLS delivery with basic security. Nginx compiled with nginx-rtmp-module & secure-link is used as media server. Features:

  • Domain filtering
  • Referrer filtering
  • Embed buster
@nguyenchilong
nguyenchilong / nginx-tuning.md
Created July 25, 2019 16:45 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@nguyenchilong
nguyenchilong / curl.md
Created July 20, 2019 20:01 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@nguyenchilong
nguyenchilong / chat-frontend.js
Created November 14, 2018 17:50 — forked from martinsik/chat-frontend.js
Node.js chat frontend and server
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var content = $('#content');
var input = $('#input');
var status = $('#status');
// my color assigned by the server
var myColor = false;
@nguyenchilong
nguyenchilong / submit.md
Created August 26, 2018 17:08 — forked from tanaikech/submit.md
Multipart-POST Request Using Node.js

Multipart-POST Request Using Node.js

Here, I introduce 2 scripts for uploading files to Slack using Node.js as samples. These 2 sample scripts are for uploading files to Slack.

Sample script 1:

  • You can upload the zip file by converting byte array as follows.
    • At first, it builds form-data.
    • Adds the zip file converted to byte array and boundary using Buffer.concat().
    • This is used as body in request.
@nguyenchilong
nguyenchilong / nginx-socketio-ssl-reverse-proxy.conf
Created June 12, 2018 07:53 — forked from fais3000/nginx-socketio-ssl-reverse-proxy.conf
How to setup nginx as nodejs/socket.io reverse proxy over SSL
upstream upstream-nodejs {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name mydomain.com www.mydomain.com;
rewrite ^(.*) https://$host$1 permanent;
}
@nguyenchilong
nguyenchilong / Virtual host settings for Nginx
Created June 12, 2018 07:52 — forked from fais3000/Virtual host settings for Nginx
Nginx Vhost settings for setting up server to serve PHP and Nodejs apps together
server {
listen 80;
server_name craftypixels.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
@nguyenchilong
nguyenchilong / Vhost settings for Apache
Created June 12, 2018 07:52 — forked from fais3000/Vhost settings for Apache
Apache2 Vhost settings for setting up server to serve PHP and Nodejs apps together
<Virtualhost>
ServerName craftypixels.com
ProxyPreserveHost on
ProxyPass /blog !
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
alias /blog /var/www/craftypixels/blog
DocumentRoot /var/www/craftypixels/blog/
Options -Indexes