Automating the Deployment and Scheduled Execution of an R script on a VPS using Laravel Forge

I love data, its in my blood, I love analysing, cleaning it and preparing it for others to use, still have to get to the last mile to displaying and visualizing it but that is a story for another day

2024 for me is the year of “automation”, for everything that I do. I have been polishing up my R skills over the holidays, as a way for moving into Python based data wrangling, however the challenges that I have faced is to do with getting my R scripts to run regularly – this has to be on a server connected to the internet since my laptop is not always on

I tried ShinyApps in the past, but this needed me to learn more things which I did not have bandwidth for.

So when Contabo my host wiped my dev VPS during the holidays, I had to re-build my sites, one of which was a documentation site built using PHP and markdown, which I wrote about Deploying a Tighten Jigsaw static site to a VPS using Laravel Forge I was deploying generated HTML to the VPS, then it hit me can’t I do the same with an R script

Setup and Configuration

  1. Install R on your server, here are steps to install R v4.x (I was able to get 4.3.2) https://medium.com/@hpgomide/how-to-update-your-r-3-x-to-the-r-4-x-in-your-linux-ubuntu-46e2209409c3
  2. Create a static site via Laravel Forge from the screenshot below
    • The domain does not really matter, use any custom sub-domain, even if it does not exist since we shall not be accessing this site anyway
    • Select Static HTML/Next.js/Nuxt.js
    • Select “website Isolation” where you specify a user name for the site, I tend to do this alot allowing me to do custom commands without using the global forge user
    • Create a new static site with Laravel Forge
  3. Install your site code repository, GitHub/Gitlab are natively supported, and uncheck the “Install Composer dependencies”, we do not need this for R
    • Install Repository
  4. The magic happens in the Deployments tab which is enabled once you have connected the code repository
    • Firstly “Enable Quick Deploy” so that whenever you push code to the selected branch in Step #2 above the code is deployed
    • Customize your R script to be executed, in my case it was a simple as in the image below. I would also recommend keeping it as simple as you can to reduce deployment headaches
    • R execution script
  5. You can also test a deployment by clicking the “Deploy Now” button at the top of the page which will re-run the last deployment

Laravel Forge is $12 per month for a single VPS, then costs $19 per month for unlimited servers

Starting A Family Through Marriage in Buganda

This article was initially published on Facebook Notes in 2010, but seems to have been deleted fortunately I found a backup version so publishing it here for the world

The centerpiece of Ganda culture, in-line with other ancient civilizations, Greece, Egypt and Rome, is family; it provides the core support for growth and development of children. Like other African cultures, the Ganda family unit is not nuclear (father, mother and children), but an extended one that includes the relatives of both parents. The Ganda culture, in particular, has also evolved to include ceremonial checks and balances.

To start a family in Kiganda culture, a couple must go through three ceremonies. During which, the girl is represented by her ssenga, usually a sister or cousin to her father and of the same clan, and the boy is also represented by an elder in his family.

The first ceremony is called kukyala, visit, which is arranged by the ssenga, where the bride-to-be shows her kitanyi or future husband, to the ssenga and a few other relatives. The purpose of the ceremony is to enable the young man to officially show his wish to marry the girl and to establish a personal relationship with the ssenga and other family members. Although the kukyala ceremony may take place in the girl’s current home, her parents do not have to be directly involved. Although it is not required, the groom-to-be  may bring gifts for the ssenga and the girl’s family.

The next phase is okwanjula, introduction, where the ssenga officially introduces the boy to the girl’s family and close friends, as the future husband. Baganda do not require that a bride price be paid for the bride. However, it is customary for the groom’s party to bring more gifts to the introduction, and some of the most symbolic include:

  • enkoko y’omuko – a chicken for the official brother-in-law.
  • omutwalo – a  symbolic bride price gift. It could take several forms depending on the groom’s financial resources. One of the more common ones is a goat (embuzi y’omutwaalo) where the goat metaphorically fills the girl’s bed—giving her no reason to return to her parents’ home.
  •  
  • The groom’s parents never attend the kwanjula and the bride’s parents never speak during the ceremony, leaving the job to a representative.  At the end of the ceremony, the parents announce the good news to the community, okubambaga, since the ceremonies, so far, have been close family affairs. The wedding ceremony, embaga, is where the entire community celebrates the union and the addition of a mature couple.

Prior to the wedding, the groom and his party come to the bride’s parent’s home to pick her up and take her to her new home, while preparing for the wedding ceremony. They bring along the kasuze katya token gifts and eat a small breakfast before leaving with the bride.

At the wedding, the groom’s parents set-up a thatched shed or tent for the couple to march around their guests, okudaala daala, hence the ceremonial shade is called ekidaala. The wedding ceremony provides the parents and other members of both families a chance to get to know one another, okumanyagana.

After the wedding, the bride, omugole, spends six days mu kisenge, indoors, in her new home–equivalent to honeymoon. When the husband is outside during these six days, the bride is pampered and counseled about her new family, oluggya, by the female relatives of her husband. On the sixth day, she may return to her parent’s home to brief them about her new life. She goes with her sisters or aunties-in-law, along with gifts of matooke (plantain), a mat, and chickens. In turn, she is usually given a papyrus basket, ekibo, by her family to take back home.

After the bride returns to her new home, the mother-in-law, nyazaala, gives her ekibo containing a number of items that are covered with banana leaves and a cluster of matooke on top, to help her run her new household.  The items include, among other things:

  • Knife – to enable her to peel food
  • A piece of cloth (akade) – the bride has to now dress decently since her husband has grown-up and can now fit the shoes of his grandfather, father or  elder brother.
  • Banana leaves and a cluster of matooke, ekiwagukira – must always has enough food for her husband when he returns from work, even if the rest of the household has already eaten.
  • Different types of food – Ensuring that the food always has sauce and vegetables.

How Uganda Revenue Authority (URA) can Engage, Develop and Support the Development of LocalTechnology Community from 2013

This resurfaced as a discussion on challenges with the URA Portal performance, so I dug back into my archives and found the concept note for this almost a decade ago – bringing it back into the open

Copying files from Mac to Android- 2023 Edition

I just got a new phone, and I needed to copy some files over from my old phone SD card onto my new phone’s self storage. There did not seem an easy way so I decided to do it old the fashioned way

  1. Copy files to my Mac
  2. Copy files to my new phone – a Samsung S23

I had not done this for a couple of time, and Android File Transfer tool was not working for me. So I searched around for options to do this.

The approach that I used

  1. Enable USB debugging on your phone
  2. Install Android Debugging Bridge (ADB) that is part of the Android platform tools package using homebrew
    brew install android-platform-tools
  3. Search for devices using adb devices which returns something below
    daemon not running; starting now at tcp:5037
    daemon started successfully
    List of devices attached
    R5CW8168GDX unauthorized
  4. As you can see this is the first time the device has been seen by adb so needs to have its fingerprint stored, all you have to do is open your phone and accept the prompts.
  5. When the prompts have been accepted, you can see the device is now available
    List of devices attached
    R5CW8168GDX device
  6. Find the path where you want to copy the files:
    • Connect to the phone
      adb shell
    • Navigate to the path where you want to put the files mine was /storage/self/primary
    • Thus I have the
  7. Push files from the computer
    adb push <absolute_local_computer_path> <absolute_remote_phone_path>
  8. Pull the files when on the phone
    adb pull <absolute_remote_phone_path> <absolute_local_computer_path>

Voila and there you are …

Are there any GUI tools that you have used in 2023?

PyCon 2023 Conference – Behind the Keynote

On Friday 22 September, 2023, I was honored to deliver the Day 2 opening keynote at the first Python Language Uganda Conference which I thoroughly enjoyed and had a great time with the attendees

When I was requested to keynote about a month ago, I said yes first which is the way I operate, and recommended by Richard Branson. Once accepted, I had a difficult path forward, as I needed something new and fresh to share with this community of young developers, techies who have more technical experience with Python than I do.

As a language python is being used in a wide range of applications, from web development with the Django framework, to data wrangling – pandas, cloud computing orchestration and configuration, into machine learning and artificial intelligence.

I am on a path to solidifying my knowledge of the langauage, which I use day-to-day working with a team building out Beyonic a customer facing digital payments and collections product that enables SMEs to effortlessly collect funds from customers, send payments to vendors, and manage cash flow.

The approach I took was to focus on the end-goal: a lifestyle with options for doing the best quality and value work, while growing in a career or running successful business enterprises, raising families, living a healthy life and contributing to the physical and online communities each of us is part of

The key message was a mindset change on how to approach building this lifestyle taking lessons from successful business owners and indie hackers, which also a reminder of the journey I am on at the moment.

For those that attended:

  1. What were your key takeaways?
  2. What questions remained in your mind?
  3. What did I miss that you think I would have covered better?

Looking forward to hearing back from you

As is my practice I have open sourced my presentation – I am big fan and key advocate