Skip to main content

Posts

Termux big digital ASCII clock script

I had this idea to create a big digital clock display using shell script in termux just for the fun of it. This is what I came up with with the help of Chatty.

Getting started with nanoc

I love static site generators. Ease of use and simplicity and speed. I remember trying 11ty and Middleman before. Today I am trying nanoc. Nanoc is written in Ruby. https://nanoc.app/doc/installation/ I am also using the siimple css framework Where the documentation could not help me, I turned to ChatGPT, for example: I am trying out nanoc static site generator. Can I have a list of images and captions and generate a page for each photo with caption and have a list of these pages on the homepage? I asked my friend Chatty about some of the considerations when choosing static site generators. When choosing a static website generator, consider ease of use, performance, customization options, and compatibility with your workflow. Evaluate factors such as the programming language and templating system it uses, support for plugins and themes, build speed, SEO features, documentation quality, community support, and how well it integrates with hosting platforms and version control systems. The...

Hobby project - play whe payout calculator

These were the ChatGPT prompts I used. It is amazing how quickly simple apps can be coded with the right prompting and proper testing and sometimes troubleshooting and debugging. I want to create a play whe payout calculator html/javascript page User enters under their wager Base1 Wager Mega Wager Base2 Wager MU Wager Base3 Wager MX Wager Then multi selects what balls have called Mega, MU, MX, MBonus, MUBonus, MXBonus Bonus pays 36 to 1 Base pays 26 to 1 Mega pays 80 to 1 MU pays 100 to 1 MX pays 125 to 1 Show calculations Base always pays out and user can only select mega or mbonus, mu or mubonus, mx or mxbonus Tax is 10% on winnings 1000 and over I tested it myself and this was the results

Hobby project - Next experiments

This is ChatGPTs suggestions on what could be some next experiments. 1. Add a queue system for async job processing and retries 2. Automate scheduled scraping with cron-based GitHub Actions 3. Create notification rules/alerts for exchange rate thresholds 4. Add authentication with Supabase Auth or OAuth 5. Build an admin dashboard with logs and controls 6. Version your API endpoints (/v1, /v2) 7. Implement webhooks for outbound event notifications 8. Add rate limiting and API security protections 9. Experiment with serverless/edge functions 10. Add real-time updates using websockets or Supabase realtime 11. Build a small ETL pipeline for transforming scraped data 12. Add monitoring, logging, and failure alerts 13. Intentionally test failures and recovery handling 14. Compare JSON storage vs databases like SQLite/Postgres 15. Add analytics and metrics collection 16. Store historical exchange rate snapshots and graph trends 17. Add caching layers and cache invalidation strategies 18. Cre...

Hobby project - Store and view exchange rates

The next step in my project was to test out being able store and display the rates in a database. I decided to use nodejs and supabase for this. Everything worked beautifully. Only hickup was the following error due to my package.json not being correct. SyntaxError: Cannot use import statement outside a module Added this to package.json   "type": "module" This works beautifully. Right now I am just testing fragments of what could be part of a bigger system to see what is possible and what works and how easy to code on a mobile. There is no fully functioning integrated end to end system just yet. This is also what I tested. A serverless append-only database using GitHub + Actions + Pages. That’s basically a lightweight backend system. This was the ChatGPT prompt I used. Guide me through each step. This is what I want. A manually run github actions that adds to docs/data.json with the current date and time. docs/index.html displays all the entries in data.json. Make s...

Hobby project - Sending exchange rates via SMS

Continuing from last blog post , I was able to send an SMS to myself using twilio and nodejs. So now I have the capability to send email or sms with data scraped from a website and schedule this to happen daily for example. And I coded all this from my android phone using termux and vim. Pretty cool. Next up I want to be able to store the exchange rates in a database and display it on a webpage to show historical values. See results below This is my code require("dotenv").config(); const axios = require("axios"); const twilio = require("twilio"); const client = twilio(   process.env.TWILIO_ACCOUNT_SID,   process.env.TWILIO_AUTH_TOKEN ); async function sendUsdRate() {   try {     const response = await axios.get(       process.env.MY_API     );     // Get USD row     const usdRow = response.data.data.find(       row => row[0] === "United States Dollar"     );     const buyingRate =...

Hobby coding project - exchange rate api

I used ChatGPT to provide the guidance. Basically I created a serverless api endpoint (using Vercel) to share the exchange rate data from the front page of the central bank website. I will contact the Central Bank to ask if they plan to provide public APIs for their data in the future. The project uses Axios + Cheerio, the Requests + BeautifulSoup of the Node.js world. Axios handles HTTP requests with a clean promise-based API. Cheerio provides jQuery-style HTML parsing without a browser. So my api endpoint serves up json exchange rate data. Next, what I did was create a Github actions to read data from the api endpoint and send it to my email address. I used resend for this and nodejs. Now I could easily send the exchange rates data to my email address on a daily basis by scheduling the action in Github. Next I am going to test out sending the data via sms if I can find a good free sms sending api. See results below.