Skip to content

Instantly share code, notes, and snippets.

nghuuphuoc / gist:7226675
Last active Dec 26, 2015
Create MySQL database with UTF8 charset
View gist:7226675
CREATE DATABASE db_name CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL ON db_name.* TO user_name@localhost IDENTIFIED BY 'password';
nghuuphuoc / gist:7260275
Last active Dec 27, 2015
Create a large file
View gist:7260275
1) dd if=/dev/zero of=FileName bs=<block size> count=<block count>
The following command creates a file named big_file.dat with size of 1GB:
dd if=/dev/zero of=big_file.dat bs=1024 count=1000000
2) mkfile -n size[b|k|m|g] filename
For example:
mkfile -n 1g big_file.txt
nghuuphuoc / gist:7288062
Created Nov 3, 2013
Disable express.bodyParser() for file upload
View gist:7288062
// Instead of
// app.use(express.bodyParser())
// use:
nghuuphuoc / gist:7348102
Last active Dec 27, 2015
Setup chroot SFTP on Centos
View gist:7348102
# See
$ groupadd apl_devs
$ useradd -g apl_devs -d /var/www/sass -s /sbin/nologin apl_dev_sass
$ passwd apl_dev_sass
Changing password for user apl_dev_sass.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
nghuuphuoc / 1) Install Nginx
Last active Dec 27, 2015
Install Nginx on Centos 6
View 1) Install Nginx
$ rpm -Uvh
$ chkconfig --add nginx
$ chkconfig --levels 235 nginx on
nghuuphuoc / gist:7398312
Last active Mar 17, 2021
Install npm, nodejs on Centos 6
View gist:7398312
# Enable Fedora Extra Packages for Enterprise Linux (EPEL) repos
$ rpm -Uvh
# Install npm from the epel repos
$ sudo yum install npm --enablerepo=epel
nghuuphuoc / gist:7424235
Created Nov 12, 2013
Use wget with Basic Authentication
View gist:7424235
wget http://url --user=<user> --password=<password>
nghuuphuoc / gist:7428288
Created Nov 12, 2013
Split and join files on Mac/Linux
View gist:7428288
// Split file
$ split -b<size>m <bigFileName> <smallerFileName>
// Join files
$ cat <smallerFileName>* > <bigFileName>
For example:
$ split -b20m
$ cat* >
nghuuphuoc / gist:7766398
Created Dec 3, 2013
Clear DNS cache on Mac
View gist:7766398
// OS X Mountain Lion or Lion
$ sudo killall -HUP mDNSResponder
// Mac OS X v10.6
$ sudo dscacheutil -flushcache
nghuuphuoc / 1) Install
Last active Dec 30, 2015
Install MySQL 5 on Centos 6
View 1) Install
$ wget
$ sudo yum localinstall mysql-community-release-el6-4.noarch.rpm
// Check MySQL Yum repos has been added
$ sudo yum repolist enabled | grep "mysql-community"
Failed to set locale, defaulting to C
mysql-community MySQL Community Server 19