Skip to content

Instantly share code, notes, and snippets.

Nam Nguyen namnm

Block or report user

Report or block namnm

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
namnm /
Created May 11, 2019
Install tools for a fresh Digital Ocean Ubuntu instance
# Permissions 0644 for '/root/.ssh/id_rsa' are too open.
chmod 400 ~/.ssh/id_rsa
# Update apt-get
sudo apt-get update
# Enable firewall
sudo apt-get install ufw
sudo ufw disable
sudo ufw allow 22
sudo ufw allow 80
namnm /
Created Oct 14, 2017
UNOMP multipool instructions

UNOMP multipool instructions

Prepare machine

  • Make swap
sudo dd if=/dev/zero of=/mnt/myswap.swap bs=1M count=4000
sudo mkswap /mnt/myswap.swap
sudo swapon /mnt/myswap.swap
namnm /
Last active May 15, 2019
Run eslint on changed files only
git status -u --porcelain | egrep -h '^[^D]{2}.*\.js$' | cut -c 4- | xargs eslint
namnm / subl_conf.json
Last active May 6, 2019
Config for Sublime
View subl_conf.json
namnm / trunc.js
Created Jan 15, 2016
js truncate method for string without cutting word
View trunc.js
String.prototype.trunc = function(n) {
if (this.length <= n) {
return this;
var truncated = this.substr(0, n);
if (this.charAt(n) === ' ') {
return truncated;
return truncated.substr(0, truncated.lastIndexOf(' '));
You can’t perform that action at this time.