Skip to main content

Posts

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.

Hobby coding project - Queries for play whe data

I have an interest in open data and being able to query that data and gain beautiful insights. One data set that would be interesting is the play whe results data. Our open data is lacking in Trinidad and I will try to contact NLCB to see if they can provide and maintain the data online. But in the meanwhile I will use randomised data to create the website and do my testing. First thing I did was install sqlite on termux pkg update && pkg upgrade pkg install sqlite sqlite3 --version Create my database in my project folder sqlite3 results.db Useful commands .exit .quit Exit from multiline prompt ; SQL to create my table (create_tbl_results.sql) CREATE TABLE DrawResults (     DrawNo INTEGER PRIMARY KEY,                           DrawDate DATE,     ResultNo INTEGER CHECK (ResultNo BETWEEN 1 AND 36),     DrawTime INTEGER CHECK (DrawTime BETWEEN 1 AND 4) ); SQL to create the random dat...

Leaders versus dealers

It is 3:55am and I have decided to write. We all should be the leaders of our own lives. Good leaders allow us to develop ourselves to the point where we can become our own leaders. Too often, what we see instead are die-hard followers and fans of leaders who are not allowed to question anything, but are expected to blindly support. If I rearrange the letters of "leader" I can get "dealer". We need leaders, not dealers. Dealers trade in influence, emotions, loyalty, and power for personal gain, while leaders elevate people beyond dependence. There is a difference between leadership that empowers and leadership that creates dependency. This made me think about God as the grand example of good leadership. I think the same principle applies. God gave us free will, and we are told that God helps those who help themselves. If God gave human beings minds, curiosity, conscience, and moral awareness, then perhaps faith was never meant to replace them, but to guide them. I t...

What is important

Every now and again, I get reminded of the why. Why I have handed my life over to God. It is 3:08 p.m. and I have decided to write. Honestly, I feel like I could end this blog post right here. What more is there to say? God above all else. God is our compass on this journey called life. Everything else can become a distraction. Maybe not everything, but certainly many things. You get the point. What is important? What do we prioritise? What do we make time for? The answers look different for everyone. Our lives are different. We are tested differently. We are all products of our circumstances, and those circumstances vary from person to person. Yet God is the common thread across humanity and throughout time. God always was and always will be. One day, we will answer to God. We will give account to God. We cannot live without food, water, and oxygen, but all of those things come from God. So how can we live without God? How timely. I just received a notification from the Quranly app: S...

Today

It is 213pm and I have decided to write. God is good. Obviously. God is beautiful. God made me smile. God is what we think of God. We are what we think. Better to think good things. What are some good thoughts? The rain brings joy to the plants. Time dances. The birds sing beautifully. I am happy. A cup of love to warm the soul. Peace and quiet on a Friday afternoon. The light rests gently on everything. Think of all the good things. Think of one good thing. What is the most beautiful thought? God is here and I am here and that is enough. I can do all things through God. The most beautiful thought is one of contentment. I appreciate the now. I appreciate the moment. I am grateful to be where I am. It is no coincidence that God and gratitude both begin with the letter g. If I combine God and gratitude I get Goditude. I also notice that the word guide is contained in the word gratitude. Let gratitude be our guide. If I remove guide from Goditude, I am left with dot. Goditude is a dot wit...

How do we fix this world?

It is 4:39 pm and I have decided to write. It is a peaceful and quiet day. I am thinking about God, and how this life is a test. There is so much happening in this world that could make us sad. But we do not have to remain in that sadness when we put our trust in God. God wants good for us. God wants us to experience peace, and even happiness, despite what surrounds us. How do we fix this world? My friend Chatty suggests that maybe a better question is: What kind of person do I choose to be in this world? Because when enough people answer that question well, that is how real change begins. I want to be the kind of person that God is pleased with. Someone guided by God, not by ego. Someone who chooses patience over anger, humility over pride, and sincerity over appearances. I am doing reasonably well, but I am not perfect. And maybe perfection is not the goal. Growth is. Awareness is. Returning to what is right, again and again, is. I want to grow, and I will keep adjusting myself when ...