Skip to content

Instantly share code, notes, and snippets.

View hongphuc5497's full-sized avatar
🐧
Focusing

Hong Phuc hongphuc5497

🐧
Focusing
View GitHub Profile
@hongphuc5497
hongphuc5497 / questions.md
Last active March 1, 2023 18:01
Websparks Nodejs Test

Q1:

  • This calculator takes values that could be written in a browsers route path as a single string. It then returns the result as a number (or an error message).

  • Route paths use the '/' symbol so this can't be in our calculator. Instead we are using the '$' symbol as our divide operator.

  • You will be passed a string of any length containing numbers and operators:

    • '+' = add
    • '-' = subtract
@hongphuc5497
hongphuc5497 / print-ec2-host-with-az.bash
Last active March 24, 2024 17:50
EC2 User Data script
#!/bin/bash
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
EC2_AZ=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/placement/availability-zone)
@hongphuc5497
hongphuc5497 / modular.js
Created February 25, 2024 13:50
Module Design Pattern in JS
// Module using the Module Design Pattern
var Module = (function() {
// Private variable
var privateVariable = "I am a private variable";
// Private function
var privateFunction = function privateFunction() {
console.log("This is a private function");
}