Retrieve instance metadata using PHP for IMDSv2

Standard
#!/bin/bash

# Update the system
apt update && apt upgrade -y

# Install Apache and PHP
apt install -y apache2 php libapache2-mod-php

# Enable and start Apache service
systemctl enable apache2
systemctl start apache2

cat <<EOF > /var/www/html/index.php

<?php
$token_url = 'http://169.254.169.254/latest/api/token';
$internal_ip_url = 'http://169.254.169.254/latest/meta-data/local-ipv4';
$public_ip_url = 'http://169.254.169.254/latest/meta-data/public-ipv4';

// Create a stream for token
$opts = [
    "http" => [
        "method" => "PUT",
        "header" => "X-aws-ec2-metadata-token-ttl-seconds: 21600",
    ]
];

// DOCS: https://www.php.net/manual/en/function.stream-context-create.php
$context = stream_context_create($opts);
$token = file_get_contents($token_url, false, $context);

// Create a stream for internal and public IP
$opts_ip = [
    "http" => [
        "method" => "GET",
        "header" => "X-aws-ec2-metadata-token: $token",
    ]
];

$context_ip = stream_context_create($opts_ip);
$internal_ip = file_get_contents($internal_ip_url, false, $context_ip);
$public_ip = file_get_contents($public_ip_url, false, $context_ip);

echo "<h1>EC2 Instance IP Addresses</h1>";
echo "<p>Internal IP: " . $internal_ip . "</p>";
echo "<p>Public IP: " . $public_ip . "</p>";

?>
EOF

# Set proper permissions
chown apache:apache /var/www/html/index.php

Dah Makan ?

Standard

Startups that delivers healthy food to your doorstep (usually lunch to office or maybe dinner at home).
Consist of 2 parts. FOOD & DELIVERY !
Foodpanda is aiming for food delivery (like DHL, Poslaju but with parcel) because they work with so many restaurants to offer many choices of food but it is very hard to minimize the cost and control the food quality.

Hence, Dah Makan have their own central kitchen.
About the central kitchen, I assume it is located at Lot.27 Jalan 16, Kampung Cheras Baru, 51600 Kuala Lumpur. http://www.jobstreet.com.my/en/companies/823202-farm-to-fork-dah-makan but then something else pop up when I search the same address.

Mangkuk Ayam Catering ! http://mangkukayamcatering.com/?page_id=63

Anyway, their main office is in Mont Kiara.

To conclude, Dah Makan is like Pizza Hut / Dominoes Pizza where they make the food and deliver to the customer.

How it works ?

1 – Customer order food through website (shopify) and mobile app (Android / iOS).
2 – Chef cooks the food from the central kitchen.
3 – Rider(20-30 people ?) deliver from central kitchen to customer.
4 – Customer gets the call from rider and pick up the food.
5 – PROFIT !

Problem ?

Based on my findings from the Play Store reviews

1 – Their order got cancel and the user is only notified by email. (Send sms / push notification instead ?)
2 – Food quality is hit or miss. (Better qc from the head chef ?)
3 – Charged twice.
4 – Somehow on February 2016 the app is not working.

Based on my findings from the Facebook comments

1 – Someone ask about Halal certification. They dont have the cert yet but the chef is muslims.
2 – How to order / what is price / is my area included (Customer’s fault for not going directly to the website but so far their social media exec handle the question well.)

My suggestion.

1 – Have your rider bring extra food especially for lunch order.

Picture this scenario when your colleague ask where to go for lunch (usually this question is very hard to answer):

Staff A – Where do you guys have lunch ? Can I join ?
Staff B – Oh. I ordered my lunch <insert food name here> from DahMakan. You need to order xx time early.
Staff A – (feeling left out).

What if the rider offers them extra food for Staff A to purchase with some extra fee ?

2 – Food suggestion for existing customer.

Rate the food or services. Or push notification by telling them some related food is available next week.
When the food is delivered, ask them for feedback (5 star rating)

3 – Delivery mode.

Assuming rider can carry 6-8 foods, dont be afraid to pair the riders with a Van. At least the rider don’t have to go back to central kitchen where they can just restock their delivery box from the Van. This is a good way to distribute the load among the riders especially when they have many orders that is around 10 KM radius but limited storage space for the riders. Consider the van as mini refrigerator 🙂

Conclusion

So far they have done a good job promoting the services by giving coupons to some company.
Their social media showing the dishes can make people mouth watering.
And lastly, hope they can scale the “traveling salesman problem”

Taman Melati Bentong

Standard

Jika anda sedang membaca post ini, bermakna anda telah sesat dan gagal mencari di mana Taman Melati Bentong Pahang.

Sila bertenang dan rehatkan minda anda . Sudah ?

Jika anda mencari menggunakan google map anda akan terjumpa result Zie’s Homestay dan dalam google map kawasan tersebut terletak di bandar berdekatan dengan balai polis. Maaf .. itu lokasi yang salah.

Taman Melati Bentong terletak di belakang SMK Bentong. Anda boleh guna gps dan cari sahaja SMK Bentong atau Jalan Muhibbah 3.

GPS LOCATION : 3.4992884 , 101.9281575

Ini adalah gambar lokasi di mana Taman Melati sepatutnya berada.

Screen Shot 2015-12-23 at 3.44.23 PM