Skip to content

Instantly share code, notes, and snippets.

View ngohuytrieu's full-sized avatar
👨‍🍳
Coding is cooking

TRIEU NGO HUY ngohuytrieu

👨‍🍳
Coding is cooking
View GitHub Profile
@ngohuytrieu
ngohuytrieu / curl.php
Created March 2, 2023 03:18
PHP curl get headers
<?php
$url = "https://www.google.com/";
$curlObj = curl_init();
curl_setopt($curlObj, CURLOPT_URL, $url);
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlObj, CURLOPT_HEADER, 1); // must set this line
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($curlObj);
@ngohuytrieu
ngohuytrieu / recover-deleted-branch.sh
Created June 7, 2023 10:06 — forked from umayr/recover-deleted-branch.sh
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@ngohuytrieu
ngohuytrieu / aws-s3-bucket-policy-configuration.md
Last active August 27, 2023 09:56
AWS S3 bucket policy configuration

1. Public access, allow all users, single action

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
@ngohuytrieu
ngohuytrieu / aws.md
Created January 19, 2024 02:35
Create AWS EC2, SSH to EC2, add domain and setup SSL for domain

Create EC2 instance

Go to https://console.aws.amazon.com/ec2 Click on Launch Instance button to add new EC2 Launch instanece button

Step 1: Choose an Amazon Machine Image (AMI)

Choose the OS type you want then click Select OS type

Step 2: Choose an Instance Type