Skip to content

Instantly share code, notes, and snippets.

View ntamvl's full-sized avatar
🏠
Working from home

Tam Nguyen ntamvl

🏠
Working from home
View GitHub Profile
@ntamvl
ntamvl / gist:5ce3bc2df292ddb86899
Last active August 29, 2015 14:27 — forked from iangreenleaf/gist:b206d09c587e8fc6399e
Rails naming conventions

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@ntamvl
ntamvl / authentication_with_bcrypt_in_rails_4.md
Created November 9, 2015 08:04 — forked from thebucknerlife/authentication_with_bcrypt_in_rails_4.md
Simple Authentication in Rail 4 Using Bcrypt

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps

@ntamvl
ntamvl / elasticsearch.md
Created March 4, 2016 04:00 — forked from dominicsayers/elasticsearch.md
Configuring ElasticSearch to use less memory

What I actually did

/etc/security/limits.conf

elasticsearch hard memlock 100000

/etc/default/elasticsearch

@ntamvl
ntamvl / install-squid-proxy-server-on-ubuntu-14-04.md
Last active May 14, 2016 08:27
Install Squid proxy server on Ubuntu 14.04

Install Squid proxy server on Ubuntu 14.04

Squid is a web proxy and cache server which primarily provides proxy and cache services for the HTTP protocol. In this tutorial we are going to show you how to install and configure Squid proxy server on a Linux VPS.

Before we start with installing and configuring Squid, let’s update all the system software to the latest version available:

sudo apt-get update && sudo apt-get -y upgrade

The update should take few moments. Once it is done, you are ready to proceed with the other steps of this tutorial. Since Squid is available in the Ubuntu repositories, the installation of Squid proxy server on an Ubuntu VPS is pretty straightforward. To install it on your server you need to run the following command:

sudo apt-get install squid
@ntamvl
ntamvl / how-to-create-a-sudo-user-on-ubuntu-quickstart.md
Created August 3, 2016 14:52
How To Create a Sudo User on Ubuntu

How To Create a Sudo User on Ubuntu

The sudo command provides a mechanism for granting administrator privileges, ordinarily only available to the root user, to normal users. This guide will show you the easiest way to create a new user with sudo access on Ubuntu, without having to modify your server's sudoers file. If you want to configure sudo for an existing user, simply skip to step 3.

Steps to Create a New Sudo User Log in to your server as the root user.

ssh root@server_ip_address

Use the adduser command to add a new user to your system.

@ntamvl
ntamvl / sketch-never-ending.md
Created June 14, 2017 05:32 — forked from Bhavdip/sketch-never-ending.md
Modify Sketch to never ending trial

###Sketch trial non stop

Open hosts files:

$ open /private/etc/hosts

Edit the file adding:

127.0.0.1 backend.bohemiancoding.com

127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com

@ntamvl
ntamvl / how-to-install-java-with-apt-get-on-ubuntu-16-04.md
Created October 13, 2017 05:03
How To Install Java with Apt-Get on Ubuntu 16.04

How To Install Java with Apt-Get on Ubuntu 16.04

Prerequisites

To follow this tutorial, you will need:

One Ubuntu 16.04 server.

A sudo non-root user, which you can set up by following the Ubuntu 16.04 initial server setup guide.
@ntamvl
ntamvl / ethereum-how-can-i-find-out-the-token-balance-of-some-address.md
Last active March 28, 2018 03:28
[Ethereum] How can I find out the ERC20 token balance of some address?

[Ethereum] How can I find out the ERC20 token balance of some address?

My Token Contract

TOKEN CONTRACT ADDRESS: 0x5d96961e2d1b3bcd7e869fa549c79c7f4140adea
TOKEN NAME: BananaCoin
TOKEN SYMBOL: BNC
Contract JSON Interface:
[ { "constant": true, "inputs": [], "name": "name", "outputs": [ { "name": "", "type": "string", "value": "BananaCoin" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "decimals", "outputs": [ { "name": "", "type": "uint8", "value": "2" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "balanceOf", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "symbol", "outputs": [ { "name": "", "type": "string", "value": "BNC" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant"
@ntamvl
ntamvl / parallels_tools_ubuntu_new_kernel_fix.md
Created May 30, 2018 02:05 — forked from rudolfratusinski/parallels_tools_ubuntu_new_kernel_fix.md
Parallels Tools fix for Ubuntu 18.04 and other Linux distributions with Kernel version >= 4.15

Preparation

  • In open Ubuntu 18.04 machine click Parallels Actions -> "Install Parallels Tools"

  • A "Parallels Tools" CD will popup on your Ubuntu desktop.

  • Open it by double mouse click, copy all the content to a new, empty directory on a desktop, name it for e.g. "parallels_fixed"

  • Open terminal, change directory to parallels_fixed (cd ~/Desktop/parallels_fixed)

  • Make command line installer executable (chmod +x install)

  • Change directory to "installer" (cd installer)

  • Make few other scripts executable: chmod +x installer.* *.sh prl_*