Skip to content

Instantly share code, notes, and snippets.

View japananh's full-sized avatar
🍀
My goal is to reach my highest potential

Anh Tran japananh

🍀
My goal is to reach my highest potential
View GitHub Profile
@japananh
japananh / build-public-image-ecr.md
Last active January 15, 2025 10:22
Build a public registry in AWS ECR (Elastic Container Registry)

How to build a public registry in AWS ECR (Elastic Container Registry)?

# Set up AWS CLI
aws configure

# Create a Public ECR Repository
aws ecr-public create-repository --repository-name redis --region <region>

# Authenticate Docker to ECR
@japananh
japananh / user_generator.sql
Last active June 8, 2023 09:27
Generate mock users in PostgreSQL
DROP TABLE IF EXISTS users;
CREATE TABLE "users" (
"id" serial PRIMARY KEY,
"first_name" varchar(255) NOT NULL,
"last_name" varchar(255) NOT NULL,
"email" varchar(255) NOT NULL,
"password" varchar(255) NOT NULL,
"created_at" timestamp DEFAULT (now())
);
@japananh
japananh / demo_primary_key.sql
Created May 26, 2023 08:22
Demo how primary key work in Postgres
DROP TABLE authors_books;
DROP TABLE books;
DROP TABLE authors;
CREATE TABLe books (
id SERIAL PRIMARY KEY ,
isbn VARCHAR(20) NOT NULL UNIQUE,
name VARCHAR(100) NOT NULL
);
@japananh
japananh / resume.json
Last active March 10, 2023 12:54
Na resume 2023
{
"meta": {
"theme": "elegant"
},
"basics": {
"name": "Anh Tran",
"label": "Backend Developer",
"image": "https://avatars0.githubusercontent.com/u/416209?s=460&u=38f220a2c9c658141804f881c334c594eb1642ac&v=4",
"summary": "I'm a motivated team player with good English communication skills seeking a challenging Back-end position in a fast-paced organization where critical thinking and creative thinking are valuable.",
"website": "https://thewriteratheart.com",
@japananh
japananh / bỏ dấu tiếng việt golang
Created October 31, 2022 06:56 — forked from vanleantking/bỏ dấu tiếng việt golang
bỏ dấu tiếng việt golang
func BoDau(province string) string {
var Regexp_A = `à|á|ạ|ã|ả|ă|ắ|ằ|ẳ|ẵ|ặ|â|ấ|ầ|ẩ|ẫ|ậ`
var Regexp_E = `è|ẻ|ẽ|é|ẹ|ê|ề|ể|ễ|ế|ệ`
var Regexp_I = `ì|ỉ|ĩ|í|ị`
var Regexp_U = `ù|ủ|ũ|ú|ụ|ư|ừ|ử|ữ|ứ|ự`
var Regexp_Y = `ỳ|ỷ|ỹ|ý|ỵ`
var Regexp_O = `ò|ỏ|õ|ó|ọ|ô|ồ|ổ|ỗ|ố|ộ|ơ|ờ|ở|ỡ|ớ|ợ`
var Regexp_D = `Đ|đ`
reg_a := regexp.MustCompile(Regexp_A)
reg_e := regexp.MustCompile(Regexp_E)
@japananh
japananh / id_mask.go
Created October 4, 2021 14:42
Generate an virtual unique identifier for the whole system
package common
/*
* @author Viet Tran <viettranx@gmail.com>
* @copyright 2019 Viet Tran <viettranx@gmail.com>
* @license Apache-2.0
*/
import (
"database/sql/driver"
@japananh
japananh / docker-cheat-sheet.sh
Last active October 1, 2021 14:55
Docker cheat sheet
# always restart container if it stops.
# reference: https://docs.docker.com/config/containers/start-containers-automatically/
docker update --restart always $(docker ps -q)
# check running containers
docker ps
# check all existed containers
docker ps -al
@japananh
japananh / 200lab_golang_training_food_delivery.sql
Created September 20, 2021 13:24 — forked from viettranx/200lab_golang_training_food_delivery.sql
This is an example DB schema for Food Delivery training project
DROP TABLE IF EXISTS `carts`;
CREATE TABLE `carts` (
`user_id` int NOT NULL,
`food_id` int NOT NULL,
`quantity` int NOT NULL,
`status` int NOT NULL DEFAULT '1',
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`user_id`,`food_id`),
@japananh
japananh / JS exercises
Last active April 11, 2021 04:17
1 - 15: easy stuffs, 16 - 25: medium stuffs, 26 - 30: hard parts
1.
var a = 1;
function doSomething() {
a = 2;
}
console.log(a);
A. 1