Skip to content

Instantly share code, notes, and snippets.

View kieetnvt's full-sized avatar
👋

Kiet Nguyen kieetnvt

👋
View GitHub Profile
@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 / [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 : 
@jackie-do
jackie-do / [postgresql]_set_up_read_only_user.md
Last active January 4, 2018 06:50
Set up a read-only user for Postgresql
  1. Create a linux user and set password
sudo adduser read_access

.. then enter your password for this user

  1. Limit permission for the user (option) .. normally, this user only has root permission on it's directory. (/home/read_access)

  2. Set read-only role for this user to use Postgresql

@kieetnvt
kieetnvt / Adyen Test card numbers
Last active January 15, 2020 03:43
Adyen Test card numbers
I. INTRO
- Only valids for TEST env
- All cards below have expiration dates and security codes:
| Expiration Date | CVV2 / CVC3 | CID (American Express) |
| 08/2018 | 737 | 7373 |
| 10/2020 | 737 | 7373 |
II. CARDS
= Mastercard
| Card Number | Card Type | Issuing Country |
@kieetnvt
kieetnvt / Ruby on Rails code guide style
Last active November 9, 2017 01:58
Ruby on Rails code guide style
Config chung
Initializer
- Để các code khởi tạo trong thư mục config/initializers. Các đoạn code để trong thư mục này sẽ tự động execute khi server khởi động.
- Để các code khởi tạo thành các file riêng theo gem. Ví dụ: carrierwave.rb, devise.rb…
Global variable
- Các biến global như email dùng để gửi mail, hostname, … nên để trong các file config/enviroments/development.rb,config/enviroments/production.rb
@kieetnvt
kieetnvt / Optimize webpage speed
Last active October 10, 2023 05:10
Optimize webpage speed
Optimize webpage speed:
- Tools: Google Pagespeed Insight, Gtmetrix.com, Webpagetest.org, Image Analysis of Webpagetest.org
- Tools mobile: Webpagetest.org, https://testmysite.thinkwithgoogle.com/
1. Using sprite CSS for all images
2. Optimize images using tool Tinypng.com
3. Eliminate render-blocking JavaScript in above-the-fold content
- Use content_for custom js in Rails