Skip to content

Instantly share code, notes, and snippets.

Hien D. Nguyen hiendnguyen

Block or report user

Report or block hiendnguyen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
from selenium import webdriver
driver = webdriver.Chrome(executable_path="C:/VNTesters/chromedriver.exe")
driver.get ("")
print (driver.title)
hiendnguyen / uwsgi.service
Last active Jul 31, 2017
Configure uWSGI server and let's make it runs as a service
View uwsgi.service
vi /etc/systemd/system/uwsgi.service
# Put below as its content
Description=uWSGI Emperor service
ExecStartPre=/usr/bin/bash -c 'mkdir -p /run/uwsgi; chown uwsgi:nginx /run/uwsgi'
ExecStart=/var/www/p3venv/bin/uwsgi --emperor /etc/uwsgi/vassals
hiendnguyen / djangodemo_uwsgi.ini
Last active Jun 6, 2019
Configure uWSGI as service
View djangodemo_uwsgi.ini
# Create 'uwsgi' user: unprivileged user
useradd -s /bin/false -r uwsgi
# Emperor mode
## create a directory for the vassals
- mkdir -p /etc/uwsgi/vassals
## Configuring uWSGI to run with a .ini file
vi /var/www/vndeveloper/djangodemo/djangodemo_uwsgi.ini
### Put below content in djangodemo_uwsgi.ini
hiendnguyen / nginx-uwsgi-django.conf
Last active Jun 6, 2019
NGINX config for uWSGI and Django
View nginx-uwsgi-django.conf
vi /etc/nginx/conf.d/django.conf
# Put below content in it.
# the upstream component NGINX needs to connect to
upstream django {
server unix:/run/uwsgi/django.sock;
# configuration of the server
server {
hiendnguyen / reCAPTCHA_Wooc.php
Last active May 5, 2017
Add reCAPTCHA to WooCommerce Signup Form
View reCAPTCHA_Wooc.php
/* wooc_reCAPTCHA */
// Add reCAPTCHA to WooCommerce Signup Form
function wooc_reCAPTCHA(){
<script src='' defer'></script>
<label>ARE YOU HUMAN?</label>
<div class="g-recaptcha" data-sitekey="[reCAPTCHA Site Key]"></div>
hiendnguyen /
Last active Jan 11, 2018
# Install Nginx
sudo yum install epel-release
sudo yum install nginx
sudo systemctl start nginx
sudo systemctl enable nginx
# Install MySQL (MariaDB)
sudo yum install mariadb-server mariadb
sudo systemctl start mariadb
sudo systemctl enable mariadb
hiendnguyen /
Last active Apr 2, 2019
CentOS 7 Virtual RAM
# In this case, I use 2G swapfile or virtual RAM
sudo dd if=/dev/zero of=/swapfile count=1024 bs=1MiB
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo sh -c 'echo "/swapfile none swap sw 0 0" >> /etc/fstab'
hiendnguyen /
Created Mar 11, 2017
CentOS 7 Timezones Configuration
# List available options
timedatectl list-timezones
# Set appropriate timezone
sudo timedatectl set-timezone America/Los_Angeles
sudo timedatectl
sudo yum install ntp -y
sudo systemctl start ntpd
sudo systemctl enable ntpd
hiendnguyen /
Created Mar 11, 2017
CentOS 7 Firewall Setup
sudo systemctl start firewalld
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
sudo systemctl enable firewalld
#To see any additional services that you can enable by name, type:
sudo firewall-cmd --get-services
hiendnguyen /
Last active Mar 11, 2017
CentOS 7 Basic Setup
# Keep your OS up to date
yum update -y
# Install basic CentOS packages
yum install wget curl unzip gcc-c++ pcre-devel zlib-devel
# Never use ROOT user, just create another user with ROOT privileges
adduser www-user
passwd www-user
gpasswd -a www-user wheel
You can’t perform that action at this time.