Skip to content

Instantly share code, notes, and snippets.

View cuonggt's full-sized avatar

Cuong Giang cuonggt

View GitHub Profile
@cuonggt
cuonggt / setup_database.md
Created September 16, 2015 16:38
Setting Up A Database on Mac OS X 10.10 Yosemite

Cài đặt Database

MySQL

Cài bằng Homebrew:

brew install mysql

Để launchd khởi động mysql khi đăng nhập:

@cuonggt
cuonggt / configuring_git.md
Last active September 17, 2015 03:11
Configuring Git

Cấu hình Git

Chúng ta sẽ sử dụng Git làm hệ thống quản lý version vì vậy chúng ta cấu hình để liên kết với tài khoản GitHub của chúng ta. Nếu bạn chưa có tài khoản GitHub, hãy đăng kí. Nó sẽ có ích trong tương lai.

Thay thế tên và địa chỉ email mẫu trong các bước sau bằng tên và địa chỉ email bạn sử dụng cho tài khoản GitHub của bạn.

git config --global color.ui true
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR@EMAIL.com"

ssh-keygen -t rsa -C "YOUR@EMAIL.com"

@cuonggt
cuonggt / setup_ruby_on_rails.md
Last active September 17, 2015 03:19
A guide to setting up a Ruby on Rails development environment

Cài đặt Ruby On Rails trên Mac OS X 10.10 Yosemite

Cài rbenv

Có 2 công cụ phổ biến để cài đặt và quản lý các phiên bản Ruby là rbenvrvm. Chúng ta sẽ sử dụng rbenv. Để cài đặt, chạy các lệnh sau trên Terminal:

brew install rbenv ruby-build
# Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile

source ~/.bash_profile

@cuonggt
cuonggt / vim_guide.md
Last active September 20, 2015 16:40
Vim guide

Vim guide

Khởi động Vim

  • vim
  • vim <file_name>

Di chuyển con trỏ trong file

  • h -- left
  • j -- down
@cuonggt
cuonggt / .bash_profile
Created September 21, 2015 07:14
.bash_profile
export PATH=$PATH:~/.composer/vendor/bin
# Add rbenv to bash so that it loads every time you open a terminal
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
# Prettier git logs
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@cuonggt
cuonggt / install_redis.md
Last active October 2, 2015 01:55
Install Redis Server

Install Redis Server

Install

brew install redis

To have launchd start redis at login:

ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
@cuonggt
cuonggt / fix_install_rmagick_gem_ubuntu
Created November 2, 2015 11:21
Fix gem install rmagick on Ubuntu
sudo apt-get install libmagickwand-dev imagemagick
@cuonggt
cuonggt / install_ibus_unikey.md
Last active November 3, 2015 01:53
Install Ibus Unikey

Install IBus Unikey

sudo add-apt-repository ppa:ubuntu-vn/ppa

sudo apt-get update

sudo apt-get install ibus-unikey

ibus restart
@cuonggt
cuonggt / deploy_ror_ubuntu.md
Last active November 5, 2015 08:54
Deploy Ruby On Rails on Ubuntu 14.04 Trusty Tahr

Tổng quan

Chúng ta sẽ thiết lập môi trường production Ruby on Rails trên Ubuntu 14.04 LTS Trusty Tahr.

Kể từ khi sử dụng Ubuntu cho môi trường phát triển, chúng ta cũng muốn sử dụng trong môi trường production. Điều này giúp ứng dụng chạy nhất quán giữa môi trường phát triển và production. Chúng ta sẽ sử dụng phiên bản LTS của Ubuntu cho môi trường production vì nó được hỗ trợ nhiều năm trong khi phiên bản Ubuntu thường không hỗ trợ.

Tạo một Virtual Private Server (VPS)

Thuê một VPS từ Digital OceanLinode.

@cuonggt
cuonggt / linux_commands.md
Created November 6, 2015 03:01
Linux Commands

Danh sách các connection

sudo netstat -tlpn