Skip to content

Instantly share code, notes, and snippets.

View hkthanh89's full-sized avatar
⛈️
Focusing

Thanh Huynh hkthanh89

⛈️
Focusing
View GitHub Profile
@hkthanh89
hkthanh89 / self_signed_ssl_aws_alb.md
Created July 25, 2024 05:10 — forked from riandyrn/self_signed_ssl_aws_alb.md
Self Signed SSL Certificate for AWS Application Load Balancer

Self Signed SSL Certificate for AWS ALB

  1. Generate private key

    $> openssl genrsa 2048 > my-private-key.pem
  2. Generate certificate using private key, you will be prompted to fill some fields. Fill required fields randomly, except for Common Name fill it with *.amazonaws.com or your valid domain name

Interview Questions

Node.js

Q1: What do you mean by Asynchronous API? ☆☆

Answer: All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.

Source: tutorialspoint.com

@hkthanh89
hkthanh89 / Caddyfile
Created June 21, 2020 17:42 — forked from Ocramius/Caddyfile
Example docker + docker-compose + caddy + traefik setup that routes to multiple apps from one exposed HTTP port
:80 {
root /serve
}

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@hkthanh89
hkthanh89 / migrate_postgresql_database.md
Created October 21, 2017 03:20 — forked from olivierlacan/migrate_postgresql_database.md
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important:

@hkthanh89
hkthanh89 / digital_ocean_setup.md
Created March 15, 2016 18:33 — forked from ChuckJHardy/digital_ocean_setup.md
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions

DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3

SSH into Root

$ ssh root@123.123.123.123

Change Root Password

# encoding: utf-8
##
# Backup Generated: my_database_backup
# Once configured, you can run the backup with the following command:
#
# $ backup perform -t my_database_backup [-c <path_to_configuration_file>]
#
# For more information about Backup's components, see the documentation at:
# http://backup.github.io/backup
@hkthanh89
hkthanh89 / push_structure_data.txt
Created October 14, 2015 09:21
Push Structure Data
Structure data:
- iOS:
{
alert: "Message show in notification",
badge: 1,
sound: "siren.aiff",
expiry: Time.now + 60*60,
content_available: true,
custom: {
event_type: "doctor_on_way",
@hkthanh89
hkthanh89 / my_database_backup_config.rb
Created May 28, 2015 11:13
Sample backup config file of backup gem
# encoding: utf-8
##
# Backup Generated: my_database_backup
# Once configured, you can run the backup with the following command:
#
# $ backup perform -t my_database_backup [-c <path_to_configuration_file>]
#
# For more information about Backup's components, see the documentation at:
# http://backup.github.io/backup
@hkthanh89
hkthanh89 / banner.rb
Last active August 29, 2015 14:21 — forked from lulalala/banner.rb
class Banner < ActiveRecord::Base
attr_accessor :image_width, :image_height
mount_uploader :image, ImageUploader
validate :check_dimensions, :on => :create
def check_dimensions
if !image_cache.nil? && (image.width < 300 || image.height < 300)
errors.add :image, "Dimension too small."
end
end