Skip to content

Instantly share code, notes, and snippets.

View thephucit's full-sized avatar

Thế Phúc thephucit

View GitHub Profile
@thephucit
thephucit / bash.sh
Created February 21, 2019 08:46
Run PostgreSQL on docker ubuntu server
sudo apt-get install docker.io
postgres=$(sudo docker run -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 postgres)
sudo docker commit $postgres kinto-db
kintodb=$(sudo docker run -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 kinto-db)
# ... Use it!
sudo docker stop $kintodb
@thephucit
thephucit / facade.php
Last active August 14, 2022 02:27
các design patterns thông dụng trong php
# đây là một mẫu lập trình biến việc sử dụng nhiều class với các phương thức khác nhau về một interface đơn giản với một phương thức,
# nói một cách đơn giản hơn là thay vì thực hiện nhiều lời gọi phương thức chúng ta chỉ thực hiện gọi một phương thức.
@dduvnjak
dduvnjak / add_cloudflare_ips.sh
Last active June 26, 2024 07:47
Add CloudFlare IP addresses to an EC2 Security Group using awscli
# first we download the list of IP ranges from CloudFlare
wget https://www.cloudflare.com/ips-v4
# set the security group ID
SG_ID="sg-00000000000000"
# iterate over the IP ranges in the downloaded file
# and allow access to ports 80 and 443
while read p
do