<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Zing Zai on Medium]]></title>
        <description><![CDATA[Stories by Zing Zai on Medium]]></description>
        <link>https://medium.com/@zingzai?source=rss-e90b249a2f80------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kJuJMBBYZUFtQKDVuJMdvA.png</url>
            <title>Stories by Zing Zai on Medium</title>
            <link>https://medium.com/@zingzai?source=rss-e90b249a2f80------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 17:49:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zingzai/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Profile Ring]]></title>
            <link>https://zingzai.medium.com/profile-ring-af4cbafd6fc7?source=rss-e90b249a2f80------2</link>
            <guid isPermaLink="false">https://medium.com/p/af4cbafd6fc7</guid>
            <category><![CDATA[profile]]></category>
            <dc:creator><![CDATA[Zing Zai]]></dc:creator>
            <pubDate>Fri, 31 Mar 2023 15:52:55 GMT</pubDate>
            <atom:updated>2023-03-31T15:52:55.213Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Profile Ring?</h3><p><a href="https://profile-ring.netlify.app/">Profile Ring</a> is an app to help you create colored 🌈 rings around your profile photos.</p><h3>Why did we create Profile Ring?</h3><ol><li>There wasn’t any colored rings on LinkedIn profiles (even for Premium LinkedIn members) and we probably had to Canva our way to get the profile ring color.</li><li>Impact and Reach! Everyone uses a profile picture.</li><li>My favourite color is Gold. 🏅</li></ol><h3>How?</h3><p>HTML5 Canvas. Talk to us, <a href="https://medium.com/u/e90b249a2f80">Zing Zai</a> and <a href="https://medium.com/u/eb1c32821b69">hc</a></p><h3>What’s Next?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*Vm8ksudr7o763MTx" /><figcaption>Roadmap. Safe Habour rules apply!</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af4cbafd6fc7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The right tool for the right job]]></title>
            <link>https://zingzai.medium.com/the-right-tool-for-the-right-job-56f0930832c6?source=rss-e90b249a2f80------2</link>
            <guid isPermaLink="false">https://medium.com/p/56f0930832c6</guid>
            <category><![CDATA[simon-sinek]]></category>
            <category><![CDATA[docusign]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Zing Zai]]></dc:creator>
            <pubDate>Mon, 21 Feb 2022 15:10:29 GMT</pubDate>
            <atom:updated>2022-03-03T19:27:40.221Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XJQPH-MroqqE2TEe.jpg" /><figcaption>Have you got the right tool?</figcaption></figure><h4>Introduction</h4><p>Recently, I spoke to a friend who does journalism. She shared that she was extremely unproductive at work and felt she accomplished nothing at the end of every day. She shared her story when she had to publish an article with me. I framed it using my favourite <a href="https://www.docusign.com/products/system-of-agreement">4 phases of the System of Agreement lifecycle</a>:</p><ol><li><strong>Prepare (Generate)</strong>: Research by searching and corroborating accurate information across disparate sources (the Internet, emails, Slack channels, legacy databases). Manually copy and paste information with source citations across sources. Break down industry specific jargons, contextualise and synthesise the information to generate the first draft on Microsoft Word</li><li><strong>Prepare (Negotiate): </strong>Play email squash to seek inputs and suggestions from senior journalists. Remind non-responsive and non-cooperative senior journalists to respond. At the same time, manually redact content to create different draft versions for different stakeholders</li><li><strong>Sign</strong>: Get final drafts approvals from management</li><li><strong>Act (Send)</strong>: Manually type and organise email addresses into groups to send the approved article versions</li><li><strong>Manage</strong>: Manually save and organise articles into shared folders (<em>not tagged for future searching…)</em></li></ol><p>It wasn’t the writing nor analysis that took her the most time, it was the inefficiencies that took her days to complete the article. This drained her entirely and dragged her feet to work everyday. It wasn’t because she lacked journalism skills or had a poor working attitude, it was simply because she wasn’t provided the right tools. Over a long period of time, this made her doubt her skills, abilities and made her feel unworthy…</p><h4><strong>Analogy</strong></h4><p>Have a look at the image above, try using a hammer to drill the nail into the hole. It might get the job done, but takes more time with many more bent nails. Wouldn’t it be great to have a screwdriver instead? Same person, less work, less time wasted.</p><h4>Finding the right tool</h4><p>This reminds me of a situation… A few months back when I was developing on Salesforce. In the beginning, I used Salesforce’s integrated development environment, <a href="https://help.salesforce.com/s/articleView?id=sf.code_dev_console.htm&amp;type=5">Developer Console</a>. Developer Console was great for <strong><em>basic</em></strong> development and testing. However, it became a nightmare to develop, debug and troubleshoot when the development became serious.</p><p>After I was introduced to the<a href="https://marketplace.visualstudio.com/items?itemName=salesforce.salesforcedx-vscode"> Salesforce Extension for Visual Studio Code</a>, my world changed. Development time shortened drastically allowing me to focus on higher order problem-solving tasks. It wasn’t that I lack the skill or ability, I was using the wrong tool for the job!</p><p>So for employees, spend some time to look for the right tool, stop wasting your time on <em>st*pid </em>tasks that don’t help you learn, grow or improve your skills.</p><h4>Providing the right tool</h4><p>I love <a href="https://www.youtube.com/watch?v=RyTQ5-SQYTo&amp;ab_channel=SimonSinek">this story shared by Simon Sinek</a> about Noah working at Four Seasons and Caesars Palace. When Noah was working at Four Seasons, whenever any manager walked past him, they would ask him whether there was anything he needed to do his job better. At Caesars Palace, managers are always ensuring he is doing everything right and catches him doing things wrong. At the Four Seasons, Noah loves his job as he feels he can be himself.</p><p>I found this story fascinating because the same person had an entirely different perspective. In this article, when I refer to the right tools, it doesn’t just refer to providing the right things to get the job done, it also includes providing the right environment.</p><p>By creating the right environment coupled with the right processes and software systems, this frees up employees time for higher value tasks, creates a cohesive environment where teams work together and sparks innovatión.</p><h4>Building the right tool</h4><p>For product teams, build the right tools that benefit your users. If you’re not believing what you’re building, why the h*ll are you building it? Because your boss has a great iDea? ⚪🐘</p><h4>Conclusion</h4><p>One of my biggest takeaways is to assess whether I’m using the right tool for the job. With technology advances these days, there are so many online tools to improve and even automate my work processes. Something I definitely think about before starting the job.</p><p>So… are you using the right tool for your job?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56f0930832c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I passed my AWS Solutions Architect — Associate Certification(2021)]]></title>
            <link>https://zingzai.medium.com/how-i-passed-my-aws-solutions-architect-associate-certification-2021-b1e426b05f4a?source=rss-e90b249a2f80------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1e426b05f4a</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-certification]]></category>
            <dc:creator><![CDATA[Zing Zai]]></dc:creator>
            <pubDate>Mon, 08 Mar 2021 14:40:24 GMT</pubDate>
            <atom:updated>2022-01-23T01:27:42.771Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>How I passed my AWS Solutions Architect — Associate Certification (2021)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/0*L7EdM-D2mZHFpyhA" /></figure><h4>Background</h4><p>I have a Computer Science degree and work as a software engineer. I do have experience in Cloud but have not worked on any AWS products.</p><h4>Start Date</h4><p>17 Feb 2021</p><h4>Exam Date</h4><p>8 Mar 2021</p><h4>Resources</h4><ol><li><a href="https://www.udemy.com/course/aws-certified-solutions-architect-associate-practice-tests-k/">AWS Certified Solutions Architect Associate Practice Exams</a>: Did 4 times;</li><li><a href="https://www.udemy.com/course/practice-exams-aws-certified-solutions-architect-associate/">Practice Exams | AWS Certified Solutions Architect Associate</a>: Did 2 paper;</li></ol><h4>Reflection</h4><p>Even though I passed on the first attempt, I felt the preparation wasn’t sufficient. Took around 2 weeks to prepare. Mostly the nights and 1.5 weekends. Preparation was mostly just attempting papers, and trying to mix in those basics I learnt from Cloud Practitioner.</p><p>Strongly encourage to have better reinforcement of the fundamentals before going for the exam. I highly recommend <a href="https://www.udemy.com/course/aws-certified-solutions-architect-associate-amazon-practice-exams-saa-c02/">AWS Certified Solutions Architect Associate Practice Exams</a>. A good friend took it and owned the exam like a bouse.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1e426b05f4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I passed my AWS Certified Cloud Practitioner (2021)]]></title>
            <link>https://zingzai.medium.com/how-i-passed-my-aws-certified-cloud-practitioner-2021-920a4a7710e?source=rss-e90b249a2f80------2</link>
            <guid isPermaLink="false">https://medium.com/p/920a4a7710e</guid>
            <category><![CDATA[amazon-web-services]]></category>
            <dc:creator><![CDATA[Zing Zai]]></dc:creator>
            <pubDate>Wed, 17 Feb 2021 12:23:20 GMT</pubDate>
            <atom:updated>2021-02-17T12:47:09.818Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/340/0*CDZR9Hjx3mbzru2e.png" /></figure><h4>Background</h4><p>I have a Computer Science degree and work as a software engineer. I do have experience in Cloud but have not worked on any AWS products.</p><h4>Start Date</h4><p>9 Feb 2021</p><h4>Exam Date</h4><p>16 Feb 2021</p><h4>Resources</h4><ol><li><a href="https://www.aws.training/Details/eLearning?id=60697">AWS Cloud Practitioner Essentials</a>: Blazed through videos once;</li><li><a href="https://www.udemy.com/course/aws-certified-cloud-practitioner-practice-test/">AWS Certified Cloud Practitioner: 6 Full Practice Exams</a>: Did twice;</li><li><a href="https://www.udemy.com/course/aws-certified-cloud-practitioner-5-practice-tests/">AWS Certified Cloud Practitioner Practice Tests — 2021</a>: Did twice;</li></ol><h4>Reflection</h4><p>I find this certification really helpful in learning about the AWS products. Useful for people who haven’t had any AWS experience and wants to use Amazon Web Services.</p><p>I did not hands-on with any of the AWS products during the preparation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=920a4a7710e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Technical lessons from building an Automated Carousell Alerting System]]></title>
            <link>https://zingzai.medium.com/learning-lessons-from-automated-carousell-alerting-system-b5c7c7fdd277?source=rss-e90b249a2f80------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5c7c7fdd277</guid>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[cronjob]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[puppeteer]]></category>
            <category><![CDATA[bots]]></category>
            <dc:creator><![CDATA[Zing Zai]]></dc:creator>
            <pubDate>Thu, 07 May 2020 14:50:30 GMT</pubDate>
            <atom:updated>2020-08-28T14:04:09.608Z</atom:updated>
            <content:encoded><![CDATA[<h3>Lessons from building a Carousell Alerting System</h3><h3>1) TLDR lessons;</h3><h4>1 minute impression</h4><p>I found the DIY version too long… It will take an average user around 10–15 minutes to create a Telegram bot and host the alerter on Heroku.</p><p>With the goal for users to receive alerts immediately, I created a Telegram bot (@caroualert_bot) and integrate it to the Cron job below. They can add items to monitor and @caroualerter_bot will send the updates.</p><h3>2) DIY lessons;</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/0*HRICODGBMUgHtIgy.png" /><figcaption>Puppeteer</figcaption></figure><h3>Using Puppeteer and Cron</h3><h4>What is Puppeteer and what I learnt?</h4><p><a href="https://developers.google.com/web/tools/puppeteer">Puppeteer</a> is a Node.js library maintained by Google’s Chrome team. <br>It allows us to use its APIs to interact with Chrome DevTools, headlessly!</p><p>Apparently, browsers have heads (UI) and headless browsers much have faster performance. I learnt that we could interact with Chrome DevTools without even opening a browser. Cool stuff, shallow learning curve.</p><h4>What is Cron and what I learnt?</h4><p><a href="https://www.npmjs.com/package/cron">Cron</a> is a JavaScript tool that allows you to execute us to run a job on a schedule. It is done using the cron syntax.</p><pre>0 0 0/1 1/1 * ? *<br>| |  |   |  | | | <br>| |  |   |  | | +-- Year              (range: 1970-2099)<br>| |  |   |  | +---- Day of the Week   (range: 1-7 or SUN-SAT)<br>| |  |   |  +------ Month of the Year (range: 0-11 or JAN-DEC)<br>| |  |   +--------- Day of the Month  (range: 1-31)<br>| |  +------------- Hour              (range: 0-23)<br>| +---------------- Minute            (range: 0-59)<br>+------------------ Second            (range: 0-59)</pre><p>I found the Cron syntax really confusing, but found <a href="https://stackoverflow.com/questions/39328351/is-there-a-difference-between-and-in-cron-expressions-strange-example">this great explanation by Quartz</a>. With this understanding, I was able to better control when I want my Cron jobs to run. Besides Unix’s Crontab, I’ve seen it being used in Nifi. So it might be useful to take some time how this syntax works.</p><h3>Before using Puppeteer…</h3><p>Before Puppeteer, I actually wrote a <a href="https://github.com/2gavy/carousellalert-py">simple Python bot </a>with Requests, BeautifulSoup4 (BS) and Pandas. Requests returns HTML content, BS parses the content and Pandas manipulates the content.<br><em>RECOMMEND: First time with Pandas’ dataframes. Powerful; Easy to learn;</em></p><h4>Insufficient info</h4><p>However, upon more careful investigation, I realised that the first response of the Carousell listing page only returned very basic info (i.e. listing name, seller’s name). I wanted more info such as <strong>image links</strong> so that I do not have to open the app manually when I see an update. Telegram will process the URL link for me and I’ll be able to see the image instantly.</p><h4>Difficult to tranverse HTML and subjected to change</h4><p>I find it troublesome to traverse HTML elements, don’t you? Also, HTML elements are more prone to change than JavaScript objects. I would prefer to work with an object is well-structured such as the browser window object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yusUfsbJhexEH1Zdx__FPA.png" /><figcaption>SearchListing object from window.initialState</figcaption></figure><p>With the limitations above, I needed another strategy. With a little more analysis work, I found out that the window.initialState object has all the info I needed and went with Puppeteer.<br><em>If you’re wondering why Puppeteer, not Selenium… at one point, you’ll have to stop comparing, decide on one and go with it. Re-evaluate it after some time.</em></p><h3>Deploying onto Heroku</h3><p>Not everyone has the time to develop an application and I wanted it to be a one-click deployment. No fuss, no hassle where anyone can use almost immediately.</p><p>This time, I studied and applied more configs for on <a href="https://github.com/2gavy/carousellalert/blob/master/app.json">app.json</a>:<br><strong>1) Env configs</strong>: Unlike my previous Heroku deployments where I needed users to manually go into the Settings to add their config vars, I prompt them at the deployment stage.<br><strong>2) Buildpacks</strong>: I had <a href="https://github.com/jontewks/puppeteer-heroku-buildpack/issues/27">similar issues</a> with deploying Puppeteer onto Heroku Stack 18 (latest). I needed to downgrade the Heroku Stack to 16 and include a <a href="https://github.com/jontewks/puppeteer-heroku-buildpack">custom buildpack</a>.<br><strong>3) Formation</strong>: By default, Heroku spins a web dyno. I wanted to use a worker dyno which is meant for background jobs and queues.</p><h3>Improvements</h3><h4>Optimised Performance</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q6zk07Ea2S-VC6Xugd04LQ.png" /></figure><p>By default, Puppeteer loads JavaScript, stylesheet, media, font etc resources. Optimisation was done to only retrieve document type resources. All other resources were aborted. Performance boost to ~1 sec.</p><h4>Improved UX</h4><p>Instead of having the user do a manual search, copy and paste in the URL. Now, they just have to enter the item search item. Encoding and parsing is automatically done for them.</p><h4>Narrowed search listings</h4><p>Unrelated listings from advertisements popped out after a while. Now, when Puppeteer launches, the cache is disabled. New sessions do not have advertisements in them<em>, so we are quite safe.</em></p><p>After some monitoring, I notice that resellers’ advertisements still appear on first load. We now automatically filter <a href="https://blog.carousell.com/bump-top-spotlight/">bumpers and spotlighters</a>.</p><h4>Migrated from mLab to MongoDB Atlas</h4><blockquote>“mLab is shutting down its Heroku add-on on November 10, 2020. You will lose access to your data unless you detach from Heroku or migrate to MongoDB Atlas before then.”</blockquote><p>29 Jul 2020: This <a href="https://docs.mlab.com/how-to-migrate-to-atlas/">guide</a> made it really easy to migrate from mLab to Atlas!</p><h3>What’s Next…</h3><p>I also learnt that there wasn’t a need for a big-ass plan. Things naturally fall into place and I started to discover where gaps were.</p><h4>Data Analytics</h4><p>I relied on Telegram’s search function <em>(Yeppie to not needing to integrate a search engine myself!)</em> to search for past listings to answer questions such as:<br>1. What is the market price for this product? Am I under/over-paying? <br>Am I getting it at a bargain? (Impetus for this bot)<br>2. How popular is the listed product? (Difficult question to answer with functions of the original site as I wasn’t able to search for <strong>SOLD, DELETED</strong>)</p><p>Despite being able to answer the above questions using Telegram, I’m still analysing things at a micro level. Leveraging of data analytics would piece things together to give the user a better picture of things he/she is monitoring.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5c7c7fdd277" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automated Carousell Alerting System]]></title>
            <link>https://zingzai.medium.com/automated-carousell-alerting-system-9792c21f7b61?source=rss-e90b249a2f80------2</link>
            <guid isPermaLink="false">https://medium.com/p/9792c21f7b61</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[buying]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[selling]]></category>
            <category><![CDATA[carousell]]></category>
            <dc:creator><![CDATA[Zing Zai]]></dc:creator>
            <pubDate>Thu, 07 May 2020 10:06:51 GMT</pubDate>
            <atom:updated>2023-12-29T06:20:21.218Z</atom:updated>
            <content:encoded><![CDATA[<h4>Check new Carousell listings and sends alerts to Telegram automatically</h4><blockquote>No longer actively support this project. You can try <a href="https://t.me/caroualert_bot">telegram bot</a>. Leave a comment if you’d like to donate for this to be maintained.</blockquote><h3>Outcome</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*gtUVQZE27xA8hXXikhp1KA.jpeg" /></figure><h4>Impetus</h4><p>During this COVID-19 pandemic, I realised most are staying at home and taking the chance to declutter. If you’re like me and one of my best friends who loves to snatch up bargains for cheap thrills, this could be a useful tool for you.</p><p>I found multiple resources that teaches you various methods of scraping Carousell. However, most if not all require some level of code writing and understanding.</p><p>Here, I will share 2 ways of how you can receive alerts on Telegram. <br><strong>1) TLDR way:</strong> Add alert bot (@caroualerter_bot) on Telegram.<br><strong>2) DIY way:</strong> Deploy your own alert bot.</p><h3>1) TLDR;</h3><ol><li>On the Telegram app, look for <a href="https://t.me/caroualert_bot">@caroualert_bot</a>.</li><li>Add an item to receive alerts using this command: /additem &lt;<em>ITEM TO MONITOR&gt;. </em>You will start receiving alerts on that group. (Your TG username and chat_id will be saved. <strong>Your mobile number will not be saved</strong>.)</li><li>Stop receive alerts using this command: /deleteitem</li></ol><h3>2) DIY;</h3><p>You will deploy your own app that:</p><ol><li>Periodically polls a Carousell listing page to <strong>check for listings</strong></li><li><strong>Scrapes new listings automatically</strong> <em>and filters resellers (optional)</em></li><li><strong>Alerts you through Telegram</strong> on the new listings</li></ol><h4>Step 1: Create a Telegram Bot to receive updates</h4><p>First you have to create your Telegram Bot. You need a Telegram Bot to send you updates. You need to retrieve your (1) Bot Token and (2) chat_id.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/0*KIg6TpsTrgwD2c-Z.png" /></figure><p><strong>Telegram Bot commands</strong></p><ol><li>Search and send message to <a href="https://telegram.me/botfather">BotFather</a>.</li><li>Type in the commands as seen above.<br><em>(/newbot, &lt;CUSTOM BOT NAME&gt;, &lt;CUSTOM BOT USERNAME&gt;)</em></li><li>Create a Telegram Group and invite your Telegram Bot into the group. Your Telegram Bot will use send updates on this group later. <em><br>You use your TG bot so that others will not know what you’re monitoring.</em></li><li>Copy and paste your Bot Token and replace it in this link, <a href="https://api.telegram.org/bot%3CYourBOTToken%3E/getUpdates">https://api.telegram.org/bot&lt;YourBOTToken&gt;/getUpdates</a>.<br><em>(i.e.</em><a href="https://api.telegram.org/bot982393737:UNVUNVUV2983293IJDFIJAF82982bjdfh/getUpdates"><em>https://api.telegram.org/bot</em><strong><em>982393737:UNVUNVUV2983293IJDFIJAF82982bjdfh</em></strong><em>/getUpdates</em></a><em>)</em></li><li>Visit the link above and you will get a response. Copy and paste the chat_id in the response.<br><em>*(i.e. {“id”:</em><strong><em>-XXXXXXXXX</em></strong><em>, ”title”:”asdf”,”type”:”group”,”all_members_are_administrators”:true},”date”:1568560744,”group_chat_created”:true}}]})<br>*The minus sign is also part of the chat_id.</em></li><li>Ensure you have your (1) Bot Token and (2) chat_id.</li></ol><h4>Step 2: Deploy App onto cloud platform</h4><p>Next, you need a Heroku account. You need a Heroku account to host your Bot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*s7aj63rovc8_elbf3SZOYw.png" /><figcaption>Deploy project on Heroku</figcaption></figure><ol><li>Sign up for a <a href="https://signup.heroku.com/">Heroku account</a>.</li><li>Go to <a href="https://github.com/2gavy/carousellalert">my Github page</a>, click on “Deploy to Heroku”.</li></ol><p>3. Enter the configs accordingly. If you’re still unsure of the configurations, more details can be found <a href="https://github.com/2gavy/carousellalert/blob/master/sampleconfig.png?raw=true">here</a>.<br><em>I have externalised sensitive configurations so that you can enter it yourself through the Heroku interface. This way, you can be sure that I am not collecting any of your info.</em></p><p>4. As soon as your application have been deployed, you will receive alerts on your Telegram Bot.</p><p><em>5. Optional: You can go to More &gt; View Logs to see what your app is doing behind the scenes!</em></p><h3>Releases</h3><h4><strong>22 Sep</strong></h4><ul><li>Attached Heroku Add-on LogDNA for better backend logging.</li></ul><h4>18 Sep</h4><ul><li>Refactored code to leverage on <a href="https://github.com/thomasdondorf/puppeteer-cluster">Puppeteer cluster</a> which allows for better control of number of pages loaded every single time. Default Puppeteer library launches all item pages at the same time and requires more memory as user base grew. Heroku’s free tier provided 512MB of memory, as soon as this limit was hit, the dyno crashes and starts up every 10 minutes later.</li></ul><h4>5 Sep</h4><ul><li>Automatically removes duplicated listings.</li></ul><h4>29 Jul</h4><ul><li>For @caroualert_bot, migrated from mLab to <strong>MongoDB Atlas</strong> as mLab will be shutting down its Heroku add-on on November 10, 2020.</li></ul><h4>7 Jun</h4><ul><li>Released refine alerts fulfilling minimum and maximum prices.</li></ul><h4>16 May</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*w087PikX2hHsuRb8WKycgw.jpeg" /><figcaption>Filter Away Seller option</figcaption></figure><ul><li>Released option to filter away seller with Telegram inline keyboard.</li></ul><h4>10 May</h4><ul><li>Released Telegram bot, @caroualert_bot for users receive alerts.</li></ul><h4>9 May</h4><ul><li>Automatically filters bumpers and spotlighters.</li><li>Optimised to only retrieve document resource types.</li></ul><h3>Support</h3><p>Feel free to leave me your suggestions!</p><p>I will convey them to my Product Owner, Product Manager, Consultant, Tech Lead, UI Engineer, Release Engineer, and Software Developer. <br>He will know what to do. :)</p><h3>For the technical folks…</h3><p>You can read about technical lessons I’ve learnt, <a href="https://medium.com/@zingzai/learning-lessons-from-automated-carousell-alerting-system-b5c7c7fdd277">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9792c21f7b61" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a free JAMStack blog using Ghost, Heroku and Netlify]]></title>
            <link>https://zingzai.medium.com/create-a-free-jamstack-blog-using-ghost-heroku-and-netlify-7727d82ae56b?source=rss-e90b249a2f80------2</link>
            <guid isPermaLink="false">https://medium.com/p/7727d82ae56b</guid>
            <category><![CDATA[jamstack]]></category>
            <category><![CDATA[blogging]]></category>
            <category><![CDATA[blog]]></category>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[netlify]]></category>
            <dc:creator><![CDATA[Zing Zai]]></dc:creator>
            <pubDate>Sat, 22 Feb 2020 15:02:43 GMT</pubDate>
            <atom:updated>2020-08-23T12:32:45.664Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*yU_VOTeIp8GD5HcS.png" /><figcaption>Ghost</figcaption></figure><h3>Background</h3><p>Blogging is a great way voice your thoughts, share your adventures and spread your ideas. It allows people to connect with one another.</p><p>Today, there are many blogging platforms out there such as WordPress.org, WordPress.com, Wix, Ghost and even Medium (<em>the platform I’m writing on…</em>). Although there are many great options, I want to create a blog that will fit most bloggers’ use-case.</p><h4>Use Case</h4><ol><li><strong>Free</strong>; blog must remain free/low-cost.</li><li><strong>100% availability</strong>; blog must always be up.</li><li><strong>Zero maintenance</strong>; blog must easy to maintain.</li><li><strong>Custom Design</strong>;<strong> </strong>blog must be unique and personalised.</li><li><strong>Custom Domain name</strong>; blog name must be easy to remember.</li><li><strong>Multiple contributors</strong>; different users can contribute to the blog.</li><li><strong>Friendly User Interface</strong>; writers must find interface easy to write on.</li></ol><h3>Why and what is Ghost, Heroku and Netlify?</h3><h4>Ghost</h4><p>After evaluating the platforms, <strong>Ghost</strong> and <em>Wordpress.org</em> were the 2 platforms remaining… Most platforms required some sort of payment while others did not allow a custom domain name. At the end of the day, I chose Ghost for its friendly UI.</p><p><strong>Ghost</strong>: an open-source headless Content-Management System(CMS).</p><h4>Heroku</h4><p>You can use the cloud-hosted Ghost… but you have to pay for it. I look for free alternatives and rather host the servers and data myself…</p><p><strong>Heroku</strong>: A platform as a service (PaaS) that will enable you to run and operate your Ghost server.</p><h4>Netlify</h4><p>To achieve 100% availability and zero maintenance, I want to deploy the blog as a static website. This would allow the blog to be independent from the Heroku servers.</p><p><strong>Netlify</strong>: An all-in-one platform for automating modern web projects.</p><h3>Prerequisites</h3><ol><li>Heroku Account<br><em>Create a Heroku Account, </em><a href="https://signup.heroku.com/"><em>here</em></a><em>.</em></li><li>GitHub Account<br><em>Create a GitHub Account, </em><a href="https://github.com/"><em>here</em></a><em>.</em></li><li>Netlify Account<br><em>Create a Netlify Account, </em><a href="https://www.netlify.com/"><em>here</em></a><em>. Connect your GitHub account to access your repositories.</em></li><li>Custom Domain Name<br><em>If you are a student, here is how you can get </em><strong><em>free custom domain names</em></strong><em>!<br>Sign up for </em><a href="https://education.github.com/pack"><em>GitHub Education</em></a><em>. You can get free custom domain names from name.com, namecheap, .TECH domain.</em></li></ol><h3>Step 1: Deploy Ghost 3.X server on Heroku</h3><p>To start off, use <a href="https://heroku.com/deploy?template=https://github.com/snathjr/ghost-on-heroku">one-click</a> to deploy a Ghost server on your Heroku. By hosting your own Ghost server, it gives you full control over your blog.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3xXVd5xiQzikCqGW73PtnQ.png" /><figcaption>Free dyno and add-ons</figcaption></figure><ol><li>You may be prompted for payment info. Do not worry, everything is <strong>$0.00</strong>!<br><em>Hint: Despite being free, you might want to try using a </em><strong><em>dummy credit card</em></strong><em>…</em></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*uxpnmx5LjjVPs9OPairfDQ.png" /><figcaption>Ghost server on Heroku</figcaption></figure><p>2. Next, enter a <strong>App name</strong>, choose a <strong>region </strong>and deploy the app.</p><p>This project automatically install add-ons and create accounts for:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FThNtTQ3WYt4iaKmhqB1nA.png" /><figcaption>MySQL Database and Tables</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wFNF_i4Qn2eb2aNWuZzoCA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*X3n2b5Q82yVSsKALVnHvMA.png" /><figcaption>Mailgun Email Service</figcaption></figure><ul><li><a href="https://cloudinary.com/"><strong>Cloudinary</strong></a> : To store images and video resources;<br><em> You can replace Cloudinary with S3. I will not cover </em><a href="https://github.com/SNathJr/ghost-on-heroku"><em>the details</em></a><em>.</em></li><li><a href="https://www.jawsdb.com/"><strong>JawsDB MySQL</strong></a>: To store actions, emails, integrations, members, permissions, posts, posts meta, roles, tags, settings, users etc.<br><em>From Heroku app overview page, click on the JawsDB add-on you installed to access your JawsDB database dashboard. You can use the credentials and MySQL Workbench to connect to your JawsDB to access your data.</em></li><li><a href="https://www.mailgun.com/"><strong>Mailgun</strong></a>: To send, receive and integrate emails. <br><em>Your blog collaborators must be authorised receipents and agree to receive emails before they will receive emails from Mailgun. More info, </em><a href="https://github.com/SNathJr/ghost-on-heroku"><em>here</em></a><em>…</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*DSAjeq5l3gWZJow1K1z7QQ.png" /><figcaption>Ghost Admin</figcaption></figure><p>3. After Ghost have been deployed, visit Ghost Admin at <a href="https://yourappname.herokuapp.com/ghost"><em>https://YOURAPPNAME.herokuapp.com/</em><strong><em>ghost</em></strong></a> and set up your admin account</p><p>4. Next, try to access your blog at <a href="https://yourappname.herokuapp.com./"><em>https://YOURAPPNAME.herokuapp.com.</em></a></p><h3>Step 2: Deploy a starter frontend on Netlify</h3><p>Although you can already access your blog in Step 1.4, it is still heavily dependent on the Heroku server. If your Heroku server fails for any particular reason, your blog will go down…</p><h4>Introducing JAMstack!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LL8bWYlnZKeZMqzE.jpg" /><figcaption>JAMSTACK</figcaption></figure><p>To ensure better resilience for your blog, you can deploy a static site with Netlify and use Ghost as a headless CMS. This leverages on the modern JAMstack that decouples the frontend and the content.</p><p><a href="https://jamstack.org/">More details</a> on why we want to use JAMstack to build websites.</p><h4>Gatsby Starter Ghost starter project</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7mVPYrA7u5IYo7NX7T9Hvw.png" /><figcaption>GitHub project from <a href="https://github.com/TryGhost/gatsby-starter-ghost">TryGhost/gatsby-starter-ghost</a></figcaption></figure><p>Fork this GitHub project from <a href="https://github.com/TryGhost/gatsby-starter-ghost">TryGhost</a>. It is a frontend starter template to build lightning fast websites with Ghost and Gatsby. For other theme templates, from <a href="https://jamstackthemes.dev/themes/">JAMStack Themes</a>.</p><p><strong>Netlify</strong>: Next, login to Netlify, choose and link the GitHub forked repository to Netlify. After linking, any changes to the GitHub repository will trigger a build and deploy the site on Netlify.<br><em>Note: If you are using the starter template, use the default build settings on Netlify</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bBkmUga_cXNXnKCCVEWEQQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1GjuJ12VqEjBH33f.jpg" /><figcaption>Netlify Overview — Successful deployed website</figcaption></figure><p>Upon completion of the first build, visit the blog by clicking on the custom domain name provided by Netlify and you’ll be able to see a similar <br><em>i.e. </em><a href="https://hungry-fermat-bc2e0c.netlify.com/"><em>https://hungry-fermat-bc2e0c.netlify.com</em></a></p><h3>Step 3: Integrate Ghost to Gatsby &amp; Netlify</h3><p>From the Ghost Admin panel, create 2 custom integrations — Gatsby &amp; Netlify.</p><h4><a href="https://gatsby.ghost.org/about/">3.1 Gatsby</a>: Populate content from own Ghost server</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IXnAqVHOEBwiZFOBC3ehFw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*BKbj7IRFOTKu5wvFcjpjMA.png" /><figcaption>Gatsby Integration</figcaption></figure><p><strong>Ghost Admin</strong>: To configure our frontend Gatsby project to populate contents from Heroku Ghost’s server, we create a Gatsby integration. Copy the values for these keys:<br>1. Content API Key<br>2. API URL</p><p><strong>Gatsby project</strong>: Open .ghost.json and change <strong>contentApiKey</strong> and <strong>apiUrl </strong>respectively with the values above.</p><h4><a href="https://ghost.org/integrations/netlify/">3.2 Netlify</a>: Updates in Ghost will trigger Netlify frontend re-builds</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e2iSoojP4Z2Pbb7EJYlZHQ.png" /><figcaption>Netlify’s Ghost build hook</figcaption></figure><p><strong>Netlify project</strong>: Create a new build hook and copy the webhook URL.<br><em>Under Site settings &gt; Build &amp; deploy.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qghXkiI8bv3cQ2RBu8N8Nw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aL-r-40hqn685h7g.png" /><figcaption>Netlify Integration Webhook</figcaption></figure><p><strong>Ghost Admin</strong>: Create a new integration webhook.</p><p>Now, whenever there is a change to Ghost (new design, new post, edit to existing post, delete of post), a webhook will be sent to Netlify to trigger a new build on your static site.</p><p>To test whether things are running correctly, create a post from Ghost Admin. Upon creation, verify:<br>1. Ghost triggered a new Netlify build and deployment of your static site.<br>2. Site populated the contents from your Ghost server.</p><h3>Step 4: Change to custom Domain Name</h3><p>Most readers wouldn’t want to enter a Netlify link to access your blog. <br>Let’s change it to a custom domain name with secured encryption by leveraging on <a href="https://docs.netlify.com/domains-https/netlify-dns/#add-a-domain">Netlify DNS</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PTcqOvQwK5_na6apfWuQsQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/0*bzKVpJwffz9MPLCb.png" /><figcaption>Netlify DNS</figcaption></figure><p><strong>Netlify</strong>: Under Netlify Domains, you can register a new domain name or add a domain you owned.</p><p><em>If you want to register a new domain name through Netlify;<br></em>No action required. Netlify-registered domains are automatically configured to use Netlify DNS.</p><p><em>If you already have a domain name with another provider;</em><strong><br>DNS Provider</strong>: Next, login to your domain provider and change your nameservers. This step takes advantage of Netlify’s managed DNS service by deletgating the domain you registered with another provider.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B_PacC2vf67g_53LH_hdNw.png" /><figcaption>Register your domain</figcaption></figure><p><strong>Netlify project</strong>: After you have Netlify DNS set up, add the domain alias to your Netlify site. Now whenever a reader hits your domain name, it will automatically be routed to your blog!</p><p>Next, secure your site by clicking on Secure Site under the HTTPS section. <br><em>(last section under Domain Management)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PZ8oUbDiI74Ipbi0zvCz0Q.png" /></figure><p><strong>Heroku</strong>: To wrap things up for custom domain name, under Settings Config Var, configure <strong>APP_PUBLIC_URL</strong> to your custom domain. Ghost will use this URL for Search Engine Optimisation (SEO).</p><h3>Step 5 : Integrate other webhooks (Optional)</h3><h4><a href="https://ghost.org/integrations/google/">Google Analytics</a>: Track site visits to gain deeper understanding of your readers</h4><p><em>I faced some issues when followed the official guide. This was what I did to overcome it;</em></p><p>After setting up a new Google Analytics property, a tracking ID will be given.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*1YI3i7kSw0g4CznCn_EOGw.png" /><figcaption>gatsby-config.js file</figcaption></figure><p><strong>Gatsby project</strong>: Run npm install gatsby-plugin-google-analytics , go to .gatsby-config.js and include the JSONObject with tracking ID as seen above.</p><h3>Conclusion</h3><p><strong>JAMstack</strong> is revolutionising the way websites are being built. In this step-by-step tutorial, I demonstrated how you can create free, customisable and static that will always be available to your readers.</p><h3>Acknowledgements</h3><p>SNathJr: <a href="https://github.com/SNathJr/ghost-on-heroku">https://github.com/SNathJr/ghost-on-heroku</a></p><p>TryGhost: <a href="https://github.com/TryGhost/gatsby-starter-ghost">https://github.com/TryGhost/gatsby-starter-ghost</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7727d82ae56b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install packages on a standalone Linux environment without Internet]]></title>
            <link>https://zingzai.medium.com/install-packages-on-a-standalone-linux-environment-without-internet-1bcc5827fba7?source=rss-e90b249a2f80------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bcc5827fba7</guid>
            <category><![CDATA[apt-get]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[centos]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Zing Zai]]></dc:creator>
            <pubDate>Wed, 29 Jan 2020 00:28:12 GMT</pubDate>
            <atom:updated>2020-01-29T00:28:50.222Z</atom:updated>
            <content:encoded><![CDATA[<p>Transfer Linux packages from online to offline envs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*vPE3VzNy_ckhQ7fQ.png" /><figcaption>Linux Penguin</figcaption></figure><h3>Pre-requisites</h3><ol><li>PC #1: Ubuntu machine with Internet access;</li><li>PC #2: Ubuntu machine without Internet access (target machine)</li><li>Storage Media: To transfer packages from PC #1 to PC #2.</li></ol><h3>PC #1 (Online)</h3><pre>URLS=$(sudo apt-get install <strong><em>PACKAGE_NAME</em></strong> --print-uris -qq | sed -n &quot;s/&#39;\([^ ]\+\)&#39; \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/ \1/p&quot;)</pre><pre>for URL in $URLS<br>do  <br>    axel $URL<br>done</pre><ul><li>Create a file (<strong>download.sh</strong>) and paste in the contents below;</li><li>Replace <em>PACKAGE_NAME</em> with package name(s) ;<br>(E.g. install <em>vim build-essential</em>)</li><li>Open Terminal and execute the script (<strong>./download.sh</strong>)</li><li>Copy downloaded packages from PC #1 to Storage Media;</li></ul><h3>PC #2 (Offline)</h3><ul><li>Insert Storage Media to PC #2;</li><li>Open Terminal and execute <strong>sudo dpkg -i *.deb</strong>;</li><li>Packages will be installed automatically;</li></ul><h3>Acknowledgements</h3><p>Full script can be found, <a href="https://github.com/harrypua/useful-scripts/blob/master/apt-online-to-offline.sh">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bcc5827fba7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Externalise and Configure Frontend Environment Variables on Kubernetes]]></title>
            <link>https://zingzai.medium.com/externalise-and-configure-frontend-environment-variables-on-kubernetes-e8e798285b3e?source=rss-e90b249a2f80------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8e798285b3e</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[vue]]></category>
            <dc:creator><![CDATA[Zing Zai]]></dc:creator>
            <pubDate>Thu, 31 Oct 2019 15:18:58 GMT</pubDate>
            <atom:updated>2019-10-31T15:35:39.356Z</atom:updated>
            <content:encoded><![CDATA[<h4>Build Once, Run Anywhere</h4><h4>Background</h4><p>This article applies for most frontend JavaScript Frameworks, i.e. React and Vue. In this article, I will share how you can externalise Vue environment (env) variables by declaring them in your Kubernetes (K8) yaml file and injecting them into your Vue app. It can also be easily adapted for React projects.</p><p><a href="https://github.com/2gavy/vue-env-sample/tree/docker">GitHub Project</a> for reference.</p><h4>Pre-requisites</h4><p>You must be fairly familiar with a JavaScript framework, Docker and K8.</p><h4>Vue’s way for handling env variables…</h4><p><a href="https://cli.vuejs.org/guide/mode-and-env.html#modes">Vue</a> taught us that we can specify different env variables for different env modes by placing different files in our project root.</p><p><a href="https://github.com/2gavy/vue-env-sample/tree/master">Sample project</a> to illustrate different .env files. <br>Development env (<em>npm run serve</em>): .env.development configs used<br>Production env (<em>npm run build, serve -s dist</em>): .env.production configs used</p><h4>Problem</h4><p>The problem occurs when we:<br>(1) Do not want to build using prod variables in dev env;<br>(2) Only want to bring our build folder into prod env; <em>We do not want to bring every god-damn file into prod!<br></em>(3) Just want to do a minor config change; <em>In a micro-service (MS) world we live in today, most of the times we do not have control over MSs we use. If an endpoint of a MS is being renamed, we do not want to redeploy our app…</em></p><h4>Idea Overview</h4><blockquote><em>1. Read variables from static JavaScript file - </em>env-config.js.<em><br>2. Reference to these variables in your code (Change </em>process.env <em>to </em>window)<em><br>3. Create shell scripts and edit Dockerfile to generate new env-config.js file at each build.<br>4. Add env variables in K8 yaml for new containers.</em></blockquote><h4>Detailed Steps</h4><blockquote><em>1. Read config from env-config.js</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*lv2u62FA5QS6AFVi7goUbw.png" /><figcaption>public/env-config.js</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EoI48E_utH1GO8Quzo_ZaA.png" /><figcaption>public/index.html (Line 8)</figcaption></figure><p><a href="https://www.w3schools.com/tags/att_script_src.asp">Traditional JavaScript reference</a> of files. No explanation required here.</p><blockquote><em>2. Reference to variables across your Vue code</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tXo35TJyiJHEOwP4-v_5Lg.png" /><figcaption>Reference variables in code (Line 42)</figcaption></figure><p>Before moving on, test out on your app on devt mode — <em>npm run serve/dev</em>. <br>You should see that your app is reading variables defined in env-config.js.</p><p>You can choose to delete .env, .env.development, .env.production files. <br>We chose to keep .env file to store configs such as long strings that seldom change (i.e. tooltip descriptions).</p><p>After ensuring that your app is working fine, we want automate the creation of env-config.js file when we build and dockerise our project.</p><blockquote><em>3. Create shell scripts </em>(generate_env-config.sh, docker_entrypoint.sh)<em> and edit Dockerfile to generate new env-config.js file at the start of each build.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*dJatwooxgQP5d6APykU4Bg.png" /><figcaption>generate_env-config.sh</figcaption></figure><p>Contains pre-defined env configs. This script takes env config values, assign them to env variables and creates our env-config.js file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*uhlEcqe_dI53fwszcgGpuA.png" /><figcaption>docker_entrypoint.sh</figcaption></figure><p>Line 1: Executes <em>generate_env-config.sh</em> and outputs <em>env-config.js</em> to build folder.<br>Line 2: Serves our build folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E0cS8JMBPyNwYpc4Rbb-vQ.png" /><figcaption>Multi-stage builds — With generating env-config.js</figcaption></figure><p>Don’t jump! This Dockerfile was written using <a href="https://docs.docker.com/develop/develop-images/multistage-build/">multi-stage builds</a> to reduce our Docker image size. With multi-stage builds, instead of manually building the image twice and maintaining multiple Dockerfiles, we just have to build our Docker image once using 1 Dockerfile.<br><em>Note: Multi-stage builds are only introduced in </em><a href="https://www.docker.com/blog/multi-stage-builds/"><em>Docker 17.06</em></a><em>.</em></p><p>Line 1–7: Install dependencies &amp; build project that outputs build folder (<em>dist)</em><br>Line 10–16: Copy only the build folder &amp; shell scripts to new Docker image. Next, install serve to host the project later. Makes the shell scripts executable. Expose the port and run <em>docker_entry.sh</em> script which creates the env-config.js in the build folder and host the project on port 5000.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*oN5RvrqydrwmuG0hCxP-QA.png" /><figcaption>Injecting VUE_APP_FOO=”docker_foo” on localhost:5000</figcaption></figure><pre>docker build -t vue-env-sample:1 .<br>docker run -p 5000:5000 -e VUE_APP_FOO=&quot;docker_foo&quot; vue-env-sample:1</pre><p>Now you can try building and running image. Inject an env variable to the container, you will be able to see your env variable being injected.</p><blockquote><em>4. Add env configs in K8 yaml for new containers.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*sxBHkAJsV95lWiB2CmRc3Q.png" /><figcaption>Kubernetes deployment yaml sample</figcaption></figure><p>This step is pretty easy after you’ve got your Docker image working. Add the env configs accordingly and you can start scaling your app on K8.</p><h4>Conclusion</h4><p>Modern JavaScript frameworks have new ways of having defining their env variables. I prefer the traditional way of injecting my configs using static scripts, but with the spirit of CI/CD, I want to be able to build my app once and deploy it anywhere. This approach allowed us to change our env variables for different envs easily and have saved us significant amount of time and effort.</p><h4>Acknowledgements</h4><p>Few months ago, I wrote a <a href="https://link.medium.com/u7UAFBMjb1">Medium post</a> on how you can externalise your Spring Boot environment variables on Kubernetes. Friends reached out and taught me how we can apply to the frontend too.</p><blockquote><em>A BIG THANK YOU to my developer friends!</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8e798285b3e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automated Bukit Batok Driving Centre (BBDC) Booking System]]></title>
            <link>https://zingzai.medium.com/automated-bukit-batok-driving-centre-bbdc-booking-system-81f0067a6b9a?source=rss-e90b249a2f80------2</link>
            <guid isPermaLink="false">https://medium.com/p/81f0067a6b9a</guid>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Zing Zai]]></dc:creator>
            <pubDate>Mon, 16 Sep 2019 16:51:14 GMT</pubDate>
            <atom:updated>2020-09-18T10:21:04.169Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>No longer actively support this project.</blockquote><h3>Outcome</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*Bgkd3eCgMOxuK318j8KQKg@2x.jpeg" /></figure><p>You will build your own app that:</p><ol><li>Periodically log in to BBDC to <strong>check</strong> <strong>for available slots </strong>for pre-defined days and sessions</li><li><strong>Performs booking automatically</strong> if an available slot matches your criteria</li><li><strong>Alerts you through Telegram</strong> when the slot has been booked</li></ol><h3>Impetus</h3><p>BBDC practical slots are always fully booked… and when it gets released (usually 1–2 days prior to the practical lesson), it is always a matter of <em>luck </em>whether you’ll be able to log in in time and book it before it gets booked away by some other student stalking the website.</p><p>There were a couple of resources that does BBDC booking automation. However, I found that there was some level of code understanding / configuration required.</p><p>Today I’ll share with you how YOU can deploy your own BBDC auto-booking system. No coding involved, just some simple config and you are good to go!</p><h3>Prerequisites</h3><ol><li>BBDC account (DUH…)</li><li>Sufficient balance in your BBDC account</li><li>Telegram Account</li></ol><h3><strong>Step 1: </strong>Create a Telegram Bot to receive updates</h3><p>First you have to create your Telegram Bot. You need a Telegram Bot to send you updates. You need to retrieve your (1) Bot Token and (2) chat_id.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*Tpjdiz0tqKqkfsuiZN5Olg.png" /><figcaption>Telegram Bot commands</figcaption></figure><ol><li>Search and send message to <a href="https://telegram.me/botfather">BotFather</a>.</li><li>Type in the commands as seen above.<br><em>(/newbot, &lt;CUSTOM BOT NAME&gt;, &lt;CUSTOM BOT USERNAME&gt;)</em></li><li>Create a Telegram Group and invite your Telegram Bot into the group. Your Telegram Bot will use send updates on this group later.</li><li>Copy and paste your Bot Token and replace it in this link, <a href="https://api.telegram.org/bot%3CYourBOTToken%3E/getUpdates">https://api.telegram.org/bot&lt;YourBOTToken&gt;/getUpdates</a>. <br><em>(i.e.https://api.telegram.org/bot</em><strong><em>982393737:UNVUNVUV2983293IJDFIJAF82982bjdfh</em></strong><em>/getUpdates)</em></li><li>Visit the link above and you will get a response. Copy and paste the chat_id in the response.<br><em>*(i.e. {“id”:</em><strong><em>-XXXXXXXXX</em></strong><em>, ”title”:”asdf”,”type”:”group”,”all_members_are_administrators”:true},”date”:1568560744,”group_chat_created”:true}}]})<br>*The minus sign is also part of the chat_id.</em></li><li>Ensure you have your (1) Bot Token and (2) chat_id.</li></ol><h3>Step 2: Deploy App onto cloud platform</h3><p>Next, you need a Heroku account. You need a Heroku account to host your Bot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ZIa0stjxNoJxDxHRwC60w.png" /><figcaption>Deploy project on Heroku</figcaption></figure><ol><li>Sign up for a <a href="https://signup.heroku.com/">Heroku account</a>.</li><li>Go to <a href="https://github.com/2gavy/bbdcbot">my Github page</a>, make a copy and deploy the project on Heroku.</li><li>After the project has been successfully deployed, click on Manage App.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ytyD8EBF3NvUQkXXqJ49rg.png" /><figcaption>Config Vars sample</figcaption></figure><p>4. Under Settings, reveal Config Vars and enter the configs above. <br><em>I have externalised sensitive configurations so that you can enter it yourself through the Heroku interface. This way, you can be sure that I am not collecting any of your info.</em></p><p>5. As soon as you have inserted the configs, you will receive updates through your Telegram Bot.</p><p>6. The app will periodically log in to BBDC website…</p><p><em>7. Optional: You can go to More &gt; View Logs to see what your app is doing behind the scenes!</em></p><h3>Acknowledgments</h3><p><a href="https://github.com/SKAshwin/bbdcbot">SKAshwin</a>: Forked this Github project and tweaked it to fit my use case:<br>* Externalised configurations<br>* Occasionally pinged hosted Heroku app to prevent it from idling<br>* Created a one-click deployment onto Heroku<br>* Wrote guide to create Telegram Bot and deploy app onto Heroku<br>* Applicable for new Oct 19 BBDC website</p><h3>Support</h3><p>Sept 19: No longer actively support this project.<br>Jul 20: Removed active session variable from code base; Tested and working.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81f0067a6b9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>