Skip to content

Instantly share code, notes, and snippets.

View jackie-do's full-sized avatar
🎯
Focusing

Huy Do jackie-do

🎯
Focusing
View GitHub Profile
@jackie-do
jackie-do / wicked-pdf_on_amazon_linux.md
Last active December 5, 2018 07:01
wicked-pdf on Amazon Linux Image and Japanese
  1. Install gem wicked-pdf
  2. Install gems to allow generate pdf from html (using wkhtmltopdf library)

wkhtmltopdf-binary ~ for general

wkhtmltopdf-binary-edge ~ for MacOS and Ubuntu/CentOS

'wkhtmltopdf-binary-aml', git: 'https://github.com/insphire/wkhtmltopdf-binary-aml' ~ for Amazon Linux (use this one)

  1. Set UTF-8 in HTML

Install

sudo apt-get update

sudo apt-get install mysql-server

Set password of root if missing

sudo service mysql stop

sudo mkdir /var/run/mysqld

@jackie-do
jackie-do / [linux]_create_user_without_home_directory_and_set_up_sftp.md
Last active March 12, 2018 07:58
Create a user without home directory and change it's directory to a new path, configure permission.

sudo adduser --no-create-home <username>

sudo usermod -d /path/to-a-directory <username>

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA <schema_name> TO <username>;

GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA <schema_name> TO <username>;

@jackie-do
jackie-do / [linux]_install_redis_on_ubuntu_16.md
Last active January 21, 2018 07:48
Set up redis for Ubuntu 16.04

1) Install Prerequisites

sudo apt-get update
sudo apt-get install build-essential tcl

2) Download, Compile, and Install Redis

  • Since we won't need to keep the source code that we'll compile long term (we can always re-download it), we will build in the /tmp directory. Let's move there and download the latest stable version of Redis.
@jackie-do
jackie-do / [linux]_check_info_of_host_server.md
Last active October 2, 2018 10:18
Some commands to check the information of a server
  1. Check linux version
cat /etc/lsb-release   (for ubuntu)
cat /etc/debian_version (for debian)
cat /etc/redhat-release (CenOs/Redhat)

  1. Check disk space
@jackie-do
jackie-do / [postgresql]_update_auto_increment_field_manually.md
Last active January 4, 2018 07:12
Update the sequence field (auto increment field) manually
  • Get the max current value of a field (base on current data)
SELECT MAX(<field_name>) FROM <table_name>;

example:

SELECT MAX(id) FROM blogs;
@jackie-do
jackie-do / set_up_vim.md
Created January 1, 2018 01:02
Set up vim
" display line number
:set number
" size of a hard tabstop
set tabstop=2
" always uses spaces instead of tab characters
set expandtab
" size of an "indent"
set shiftwidth=2
@jackie-do
jackie-do / [postgresql]_set_up_authentications_postgresql_user.md
Last active January 4, 2018 06:50
Set up authentication methods for postgresql users
  1. Go to config directory
 cd /etc/postgresql/<postgresql_version>/main
  1. Open and update file "pg_hba.conf" to dismiss all authentications for "postgres" user (normally line 85)
  • Before updating
 local   all             postgres                                peer
@jackie-do
jackie-do / [linux]_user_permissions_in_linux.md
Last active March 12, 2018 08:34
Grant and update user permission in Linux

Changing a file/directory ownership

  1. Check file's permissions and ownership
ll
  1. Changing A File Ownership
sudo chown :