Skip to content

Instantly share code, notes, and snippets.

View namdp06's full-sized avatar

Đặng Phương Nam namdp06

  • CYBRIDGE ASIA
  • Ho Chi Minh
View GitHub Profile
@namdp06
namdp06 / 2019-https-localhost.md
Created March 25, 2020 09:47 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@namdp06
namdp06 / check-apache-instances.sh
Created May 28, 2018 04:34 — forked from tbjers/check-apache-instances.sh
Script to determine Apache ServerLimit and MaxClients.
#!/bin/sh
ps -ylC httpd --sort:rss | awk '{ s += $8; } END \
{ print "Average Size:", s/NR/1024, "MB,", NR, \
"servers, Total usage:", (s/NR/1024)*NR, "MB, Max Servers:", \
6500/(s/NR/1024) }'
@namdp06
namdp06 / nginx-tuning.md
Created April 12, 2018 10:21 — 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.

@namdp06
namdp06 / ebs-backup.py
Last active September 16, 2016 04:52
Create EBS Snapshots, keep them 7 days and delete expired snapshots
import boto3
import re
import collections
import datetime
ec = boto3.client('ec2')
iam = boto3.client('iam')
def lambda_handler(event, context):
reservations = ec.describe_instances(
@namdp06
namdp06 / read-write-file.js
Created August 31, 2016 19:15
Read Write to file with javascript
/// write to file
var txtFile = "c:/test.txt";
var file = new File(txtFile);
var str = "My string of text";
file.open("w"); // open file with write access
file.writeln("First line of text");
file.writeln("Second line of text " + str);
file.write(str);
file.close();
sudo yum -y install gcc gcc-c++ kernel-devel
sudo yum -y install python-devel libxslt-devel libffi-devel openssl-devel
pip install cryptography